-
Notifications
You must be signed in to change notification settings - Fork 157
/
Taskfile.yml
50 lines (45 loc) · 2.96 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
42
43
44
45
46
47
48
49
50
version: '3'
vars:
PKG_PATH: github.com/asoul-sig/asouldocs/internal/conf
BUILD_TIME:
sh: date -u '+%Y-%m-%d %I:%M:%S %Z'
BUILD_COMMIT:
sh: git rev-parse HEAD
tasks:
web:
desc: Build the binary and start the web server
deps: [build]
cmds:
- ./asouldocs web
build:
desc: Build the binary
cmds:
- go build -v
-ldflags '
-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}"
-X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}"'
-trimpath -o asouldocs
sources:
- main.go
- internal/**/*.go
- conf/**/*
- public/embed.go
- templates/embed.go
- docs/toc.ini
method: timestamp
clean:
desc: Cleans up system meta files
cmds:
- find . -name "*.DS_Store" -type f -delete
- rm asouldocs_* checksum_sha256.txt
release:
desc: Build the binaries and pack resources to ZIP archives
cmds:
- env GOOS=darwin GOARCH=amd64 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs; tar czf asouldocs_{{.BUILD_VERSION}}_darwin_amd64.tar.gz asouldocs
- env GOOS=darwin GOARCH=arm64 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs; tar czf asouldocs_{{.BUILD_VERSION}}_darwin_arm64.tar.gz asouldocs
- env GOOS=linux GOARCH=amd64 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs; tar czf asouldocs_{{.BUILD_VERSION}}_linux_amd64.tar.gz asouldocs
- env GOOS=linux GOARCH=386 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs; tar czf asouldocs_{{.BUILD_VERSION}}_linux_386.tar.gz asouldocs
- env GOOS=linux GOARCH=arm go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs; tar czf asouldocs_{{.BUILD_VERSION}}_linux_arm.tar.gz asouldocs
- env GOOS=windows GOARCH=amd64 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs.exe; tar czf asouldocs_{{.BUILD_VERSION}}_windows_amd64.tar.gz asouldocs
- env GOOS=windows GOARCH=386 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs.exe; tar czf asouldocs_{{.BUILD_VERSION}}_windows_386.tar.gz asouldocs
- shasum -a 256 asouldocs_* >> checksum_sha256.txt