4ef05732e7dea301cbc205dcb97a84e3fb5f3862
- Author
- Kieran Klukas <kieran@dunkirk.sh>
- Committer
- Kieran Klukas <kieran@dunkirk.sh>
- Date
Message
feat: add a taskfile
Diff
1diff --git a/Taskfile.yaml b/Taskfile.yaml
2new file mode 100644
3index 0000000000000000000000000000000000000000..aa5860f4c6baba40e70415b18f18696eda038018
4--- /dev/null
5+++ b/Taskfile.yaml
6@@ -0,0 +1,53 @@
7+# https://taskfile.dev
8+
9+version: "3"
10+
11+tasks:
12+ fmt:
13+ desc: Run gofumpt and goimports
14+ cmds:
15+ - golangci-lint fmt
16+
17+ lint:
18+ desc: Run base linters
19+ cmds:
20+ - golangci-lint run
21+
22+ lint:fix:
23+ desc: Run linters and apply automatic fixes
24+ cmds:
25+ - golangci-lint run --fix
26+
27+ test:
28+ desc: Run tests
29+ cmds:
30+ - go test -race ./... {{.CLI_ARGS}}
31+
32+ tidy:
33+ desc: Run go mod tidy
34+ cmds:
35+ - go mod tidy
36+
37+ release:
38+ desc: Create and push a new tag following semver
39+ vars:
40+ NEXT:
41+ sh: svu next --always || go run github.com/caarlos0/svu/v3@latest next --always
42+ prompt: "This will release {{.NEXT}}. Continue?"
43+ preconditions:
44+ - sh: '[ $(git symbolic-ref --short HEAD) = "main" ]'
45+ msg: Not on main branch
46+ - sh: "[ $(git status --porcelain=2 | wc -l) = 0 ]"
47+ msg: "Git is dirty"
48+ - sh: 'gh run list --workflow build.yml --commit $(git rev-parse HEAD) --status success --json conclusion -q ".[0].conclusion" | grep -q success'
49+ msg: "Test build for this commit failed or not present"
50+ cmds:
51+ - task: fetch-tags
52+ - git commit --allow-empty -m "{{.NEXT}}"
53+ - git tag --annotate --sign -m "{{.NEXT}}" {{.NEXT}} {{.CLI_ARGS}}
54+ - echo "Pushing {{.NEXT}}..."
55+ - git push origin main --follow-tags
56+
57+ fetch-tags:
58+ cmds:
59+ - git fetch --tags