-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
53 lines (47 loc) · 1.43 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
45
46
47
48
49
50
51
52
53
# This file can be run with the `task` utility: https://taskfile.dev/
version: "3"
tasks:
mod:
desc: Downloads and tidy Go modules
cmds:
- go mod download
- go mod tidy
clean:
desc: Cleans up build artifacts
preconditions:
- test -d ./dist
- test -f ./dist/{{project.name}}
cmds:
- rm -f ./dist/{{project.name}}
update-version-file:
cmds:
- go run tools/build-version.go
add-version-file-to-last-commit:
internal: true
cmds:
- git add internal/version/version.go
- git commit --amend --no-edit --allow-empty --no-verify ./internal/version/version.go
build:
desc: Builds {{project.name}} binary
vars:
GIT_COMMIT:
sh: git log -n 1 --format=%h
sources:
- "./app/**/*.go"
- "./cmd/**/*.go"
- "./internal/**/*.go"
- "./main.go"
generates:
- ./dist/{{project.name}}
cmds:
- mkdir -p ./dist
- task: update-version-file
- task: add-version-file-to-last-commit
- go build -trimpath -ldflags="-s -w -X main.Version={{.VERSION}}-{{.GIT_COMMIT}}" -o dist/{{project.name}} .
autobuild:
interactive: true
desc: Watches for changes, automatically rebuilds the project & displays a minimal system notification
preconditions:
- which watchexec
cmds:
- watchexec --exts go --fs-events create,modify,remove -N --debounce 500 -w ./app -w ./cmd -w ./internal -- task build -f