-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
41 lines (35 loc) · 1.29 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
version: '3'
vars:
PROGRAM: autoversion
tasks:
run:
# task run -- --lang (the first -- is needed)
- autoversion
- go run cmd/main.go {{.CLI_ARGS}}
build:
deps: [test]
cmds:
- autoversion
- go build -o {{.PROGRAM}} cmd/main.go
install:
cmds:
- cp {{.PROGRAM}} ~/go/bin/
test:
- go test -failfast ./...
# does not call [build] task.
# you need to do this manually before create-release-for-github
# otherwise the current version number cannot be determined since
# the vars: section always runs before any other deps
create-release-for-github:
vars:
PRG_VERSION:
sh: autoversion --version
cmds:
- rm releases/*
- GOOS=darwin GOARCH=amd64 go build -o releases/{{.PROGRAM}}_{{.PRG_VERSION}}_darwin_amd64 cmd/main.go
- GOOS=darwin GOARCH=arm64 go build -o releases/{{.PROGRAM}}_{{.PRG_VERSION}}_darwin_arm64 cmd/main.go
- GOOS=linux GOARCH=amd64 go build -o releases/{{.PROGRAM}}_{{.PRG_VERSION}}_linux_amd64 cmd/main.go
- GOOS=windows GOARCH=amd64 go build -o releases/{{.PROGRAM}}_{{.PRG_VERSION}}_windows_amd64.exe cmd/main.go
# https://cli.github.com/manual/gh_release_create
# https://github.com/cli/cli
- gh release create v{{.PRG_VERSION}} ./releases/* --title v{{.PRG_VERSION}}