From 7c2604c0bf3f521d2e44df90a74f0bba5310d784 Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Sun, 10 Nov 2024 09:31:03 +0100 Subject: [PATCH] feat: add release management via `Task` - create `Taskfile.yml` - initial tasks - add new version tag - push to remote and run goreleaser - create snapshot via goreleaser --- .goreleaser.yaml | 1 - Taskfile.yml | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Taskfile.yml diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 3dba24b..644912b 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -5,7 +5,6 @@ version: 2 before: hooks: - - rm -fr ./dist - go mod tidy builds: diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..8efbf3a --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,34 @@ +# yaml-language-server: $schema=https://taskfile.dev/schema.json +# +# github.com/go-task/task/v3/cmd/task@latest +# Requirements: +# github.com/caarlos0/svu@latest +# github.com/goreleaser/goreleaser/v2@latest + +version: '3' + +tasks: + + release: + desc: Create and publish an new release + vars: + RELEASE: + sh: svu next + BRANCH: + sh: git branch --show-current + COMMIT: + sh: git rev-parse --short --verify {{.BRANCH}} + preconditions: + - sh: test "{{.BRANCH}}" == "main" + msg: "You must be on the main branch to release" + prompt: Create new release {{.RELEASE}} from {{.COMMIT}}@{{.BRANCH}}? + cmds: + - git tag {{.RELEASE}} + - git push + - git push origin tag {{.RELEASE}} + - goreleaser release --clean + + snapshot: + desc: Create a local snapshot release + cmds: + - goreleaser release --clean --snapshot