-
Notifications
You must be signed in to change notification settings - Fork 2
/
Taskfile.yml
39 lines (33 loc) · 1.03 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
version: '3'
vars:
NAME: go-import-server
BUILD_TIME:
sh: date -u '+%Y-%m-%d %I:%M:%S %Z'
BUILD_COMMIT:
sh: git rev-parse HEAD
tasks:
default:
cmds:
- task: web
web:
desc: Build the binary and start the web server
deps: [build]
cmds:
- ./{{.NAME}}
build:
desc: Build binary
cmds:
- go build -v -trimpath -o {{.NAME}}
sources:
- ./*.go
release:
desc: Build the binary and pack resources to ZIP files
cmds:
- env GOOS=darwin GOARCH=amd64 go build -ldflags '-X main.Version={{.BUILD_COMMIT}}' -o {{.NAME}}; tar czf {{.NAME}}_darwin_amd64.tar.gz {{.NAME}}
- env GOOS=linux GOARCH=amd64 go build -ldflags '-X main.Version={{.BUILD_COMMIT}}' -o {{.NAME}}; tar czf {{.NAME}}_linux_amd64.tar.gz {{.NAME}}
- env GOOS=windows GOARCH=amd64 go build -ldflags '-X main.Version={{.BUILD_COMMIT}}' -o {{.NAME}}; tar czf {{.NAME}}_windows_amd64.tar.gz {{.NAME}}
clean:
desc: Clean up meta and packed files
cmds:
- go clean
- rm -f *.tar.gz