-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathTaskfile.yml
109 lines (90 loc) · 2.53 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# https://taskfile.dev
# https://github.com/mdouchement/checksum
version: '3'
vars:
VERSION: 0.13.1
REVISION: { sh: git rev-parse HEAD }
WORKDIR: { sh: pwd }
env:
GO111MODULE: on
CGO_ENABLED: 0
tasks:
docker:
desc: Build a Docker image of the server
cmds:
- task: clean
- docker build -t mdouchement/standardfile:{{.VERSION}} .
clean:
desc: Clean project
cmds:
- rm -rf {{.WORKDIR}}/dist
build-server:
desc: Build the server
cmds:
- task: clean
- mkdir -p {{.WORKDIR}}/dist
- task: build
vars:
BINARY_NAME: standardfile
ENTRYPOINT: "{{.WORKDIR}}/cmd/standardfile"
TARGET_DIST: ""
build-all:
desc: Build all binaries
cmds:
- task: clean
- mkdir -p {{.WORKDIR}}/dist
- task: build
vars:
BINARY_NAME: standardfile-linux-amd64
ENTRYPOINT: "{{.WORKDIR}}/cmd/standardfile"
TARGET_DIST: GOOS=linux GOARCH=amd64
- task: checksum
vars:
BINARY_NAME: standardfile-linux-amd64
- task: build
vars:
BINARY_NAME: standardfile-linux-arm64
ENTRYPOINT: "{{.WORKDIR}}/cmd/standardfile"
TARGET_DIST: GOOS=linux GOARCH=arm64
- task: checksum
vars:
BINARY_NAME: standardfile-linux-arm64
- task: build
vars:
BINARY_NAME: sfc-linux-amd64
ENTRYPOINT: "{{.WORKDIR}}/cmd/sfc"
TARGET_DIST: GOOS=linux GOARCH=amd64
- task: checksum
vars:
BINARY_NAME: sfc-linux-amd64
- task: build
vars:
BINARY_NAME: sfc-darwin-amd64
ENTRYPOINT: "{{.WORKDIR}}/cmd/sfc"
TARGET_DIST: GOOS=darwin GOARCH=amd64
- task: checksum
vars:
BINARY_NAME: sfc-darwin-amd64
- task: build
vars:
BINARY_NAME: sfc-windows-amd64.exe
ENTRYPOINT: "{{.WORKDIR}}/cmd/sfc"
TARGET_DIST: GOOS=windows GOARCH=amd64
- task: checksum
vars:
BINARY_NAME: sfc-windows-amd64.exe
build:
dir: "{{.ENTRYPOINT}}"
cmds:
- '{{.TARGET_DIST}} go build -ldflags "{{.LDFLAGS | splitList "\n" | join " "}}" -o {{.WORKDIR}}/dist/{{.BINARY_NAME}} .'
vars:
LDFLAGS: |
-s
-w
-X main.version={{.VERSION}}
-X main.revision={{ printf "%.7s" .REVISION }}
-X main.date={{now | date "2006-01-02~15:04:05"}}
checksum:
dir: "{{.WORKDIR}}/dist"
cmds:
- checksum --algs="sha256" --append-to checksum.txt {{.BINARY_NAME}}