chore: add release task

Kujtim Hoxha created

Change summary

Taskfile.yaml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

Detailed changes

Taskfile.yaml 🔗

@@ -25,3 +25,19 @@ tasks:
     desc: Run tests for all packages
     cmds:
       - go test ./... -count=1 {{.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"
+    cmds:
+      - git commit --allow-empty -m "{{.NEXT}}"
+      - git tag --annotate --sign -m "{{.NEXT}}" {{.NEXT}} {{.CLI_ARGS}}
+      - echo "Pushing {{.NEXT}}..."
+      - git push origin main --follow-tags