38 lines
1.1 KiB
YAML
38 lines
1.1 KiB
YAML
# https://taskfile.dev
|
|
|
|
version: "3"
|
|
|
|
tasks:
|
|
lint:
|
|
desc: Run lint
|
|
cmds:
|
|
- golangci-lint run
|
|
|
|
test:
|
|
desc: Run tests
|
|
cmds:
|
|
- go test -race -count 4 -cpu 1,4 ./... {{.CLI_ARGS}}
|
|
|
|
release:
|
|
desc: Create and push a new tag following semver
|
|
vars:
|
|
NEXT:
|
|
sh: svu next --always || go run github.com/caarlos0/svu/v3@latest next --always
|
|
prompt: "This will release {{.NEXT}}. Continue?"
|
|
preconditions:
|
|
- sh: '[ $(git symbolic-ref --short HEAD) = "main" ]'
|
|
msg: Not on main branch
|
|
- sh: "[ $(git status --porcelain=2 | wc -l) = 0 ]"
|
|
msg: "Git is dirty"
|
|
- sh: 'gh run list --workflow build.yml --commit $(git rev-parse HEAD) --status success --json conclusion -q ".[0].conclusion" | grep -q success'
|
|
msg: "Test build for this commit failed or not present"
|
|
cmds:
|
|
- task: fetch-tags
|
|
- git commit --allow-empty -m "{{.NEXT}}"
|
|
- git tag --annotate --sign -m "{{.NEXT}}" {{.NEXT}} {{.CLI_ARGS}}
|
|
- echo "Pushing {{.NEXT}}..."
|
|
- git push origin main --follow-tags
|
|
|
|
fetch-tags:
|
|
cmds:
|
|
- git fetch --tags
|