1version: "3"
2
3tasks:
4 fmt:
5 desc: Run gofumpt for all packages
6 cmds:
7 - gofumpt -w .
8
9 modernize:
10 desc: Run modernize for all packages
11 cmds:
12 - modernize -fix ./...
13
14 lint:
15 desc: Run base linters for all packages
16 cmds:
17 - golangci-lint run
18
19 lint:fix:
20 desc: Run base linters for all packages and applies fixes if possible
21 cmds:
22 - golangci-lint run --fix
23
24 test:
25 desc: Run tests for all packages
26 cmds:
27 - go test ./... -count=1 {{.CLI_ARGS}}
28 release:
29 desc: Create and push a new tag following semver
30 vars:
31 NEXT:
32 sh: svu next --always || go run github.com/caarlos0/svu/v3@latest next --always
33 prompt: "This will release {{.NEXT}}. Continue?"
34 preconditions:
35 - sh: '[ $(git symbolic-ref --short HEAD) = "main" ]'
36 msg: Not on main branch
37 - sh: "[ $(git status --porcelain=2 | wc -l) = 0 ]"
38 msg: "Git is dirty"
39 cmds:
40 - git commit --allow-empty -m "{{.NEXT}}"
41 - git tag --annotate --sign -m "{{.NEXT}}" {{.NEXT}} {{.CLI_ARGS}}
42 - echo "Pushing {{.NEXT}}..."
43 - git push origin main --follow-tags