-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
77 lines (67 loc) · 1.62 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
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
# DATE:
# sh: date +"%d%b%y%R%Z"
# -X go.szostok.io/version.buildDate={{.Date}}
DIRTY_VERSION:
sh: git describe --tags --abbrev=12 --dirty --broken
BIN_NAME:
sh: basename $(pwd)
GOOS:
sh: go env GOOS
GOARCH:
sh: go env GOARCH
GOHOST: "GOOS={{.GOOS}} GOARCH={{.GOARCH}} go"
CGO: "CGO_ENABLED=0"
LDFLAGS: |
-s -w
-X go.szostok.io/version.version={{.DIRTY_VERSION}}
tasks:
# TODO: add default task
default:
cmds:
- task: clean
install:
desc: Install the binary
aliases: [i]
cmds:
- "{{.CGO}} {{.GOHOST}} install -ldflags '{{.LDFLAGS}}' ."
mod:
desc: Downloads and tidy Go modules
cmds:
- go mod download
- go mod tidy
clean:
desc: Clean temp files and folders
cmds:
- rm -rf ./dist/
- rm -rf ./bin/
build:
desc: Build the binary
deps: [clean]
cmds:
- "{{.CGO}} {{.GOHOST}} build -ldflags '{{.LDFLAGS}}' -o {{.BIN_NAME}}"
- mkdir -p bin
- mv {{.BIN_NAME}} bin/
build-snapshot:
desc: Build a snapshot with goreleaser
deps: [clean]
cmds:
- goreleaser --snapshot
changelog:
desc: Generate changelog
cmds:
- git-chglog --next-tag {{.VERSION}} -o CHANGELOG.md
release:
desc: Release a new tag
deps: [build, changelog]
cmds:
- git add CHANGELOG.md
- git commit -m "{{.GIT_CHORE}} update changelog for {{.VERSION}}"
- git tag {{.VERSION}}
- git push origin main {{.VERSION}}
vars:
GIT_CHORE: "chore:"
# TODO: add test task
# test: