Commit 754e4d7

Karn Wong <[email protected]>
2024-07-25 10:01:32
ci: set dynamic version number tag: v0.1.1
1 parent 518fb2d
Changed files (4)
.github/workflows/release.yaml
@@ -25,7 +25,7 @@ jobs:
         uses: goreleaser/goreleaser-action@v6
         with:
           distribution: goreleaser
-          version: "~> v1"
+          version: "~> v2"
           args: release --clean
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cmd/root.go
@@ -9,9 +9,13 @@ import (
 	"github.com/spf13/cobra"
 )
 
+var (
+	version = "dev"
+)
+
 var rootCmd = &cobra.Command{
 	Use:     "swissknife",
-	Version: "0.1.0",
+	Version: version,
 	Short:   "Various utils",
 	Long:    `Various utils`,
 }
.gitignore
@@ -1,3 +1,5 @@
 .env
 build
 swissknife
+
+dist/
.goreleaser.yaml
@@ -0,0 +1,33 @@
+---
+version: 2
+
+builds:
+  - env:
+      - CGO_ENABLED=1
+    goos:
+      - linux
+      - windows
+      - darwin
+    ldflags:
+      - -X github.com/kahnwong/swissknife/cmd.version={{.Version}}
+
+
+archives:
+  - format: tar.gz
+    name_template: >-
+      {{ .ProjectName }}_
+      {{- title .Os }}_
+      {{- if eq .Arch "amd64" }}x86_64
+      {{- else if eq .Arch "386" }}i386
+      {{- else }}{{ .Arch }}{{ end }}
+      {{- if .Arm }}v{{ .Arm }}{{ end }}
+    format_overrides:
+      - goos: windows
+        format: zip
+
+changelog:
+  sort: asc
+  filters:
+    exclude:
+      - "^docs:"
+      - "^test:"