-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
44 lines (37 loc) · 1.24 KB
/
Taskfile.yaml
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
# https://taskfile.dev
version: '3'
vars:
DIST_FOLDER: "dist"
APPNAME: "up-npm"
VERSION:
# 3.1.2
# sh: '{{if eq OS "windows"}}more .version{{else}}cat .version{{end}}'
sh: 'Powershell.exe -File getPackageVersion.ps1'
tasks:
test:
cmds:
- go test ./...
build:
cmds:
- task: test
- task: prepareDistFolder
- task: setVersion
- echo "Building version {{.VERSION}}"
- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -trimpath -tags=netgo -o {{.DIST_FOLDER}}/{{.APPNAME}}-{{.VERSION}}-windows-amd64.exe
- CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -trimpath -tags=netgo -o {{.DIST_FOLDER}}/{{.APPNAME}}-{{.VERSION}}-darwin-amd64
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -trimpath -tags=netgo -o {{.DIST_FOLDER}}/{{.APPNAME}}-{{.VERSION}}-linux-amd64
- echo "Build complete"
- task: checksum
silent: false
checksum:
cmds:
- go run ./utils/checksum.go
silent: false
prepareDistFolder:
cmds:
- go run ./utils/cleanFolder/main.go -path dist
silent: false
setVersion:
cmds:
- go run ./utils/setVersion/main.go --version {{.VERSION}}
silent: false