diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..c7d7b17 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,40 @@ +version: 2 + +before: + hooks: + - go mod tidy + +builds: + - main: ./cmd/sgard + env: + - CGO_ENABLED=0 + ldflags: + - -s -w -X main.version={{.Version}} + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + +archives: + - formats: [binary] + name_template: >- + {{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{- if .Arm }}v{{ .Arm }}{{ end }}_v{{ .Version }} + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + +release: + github: + owner: kisom + name: sgard + footer: >- + + --- + + Released by [GoReleaser](https://github.com/goreleaser/goreleaser). diff --git a/cmd/sgard/version.go b/cmd/sgard/version.go new file mode 100644 index 0000000..abe9a1b --- /dev/null +++ b/cmd/sgard/version.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var version = "dev" + +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Print the version", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println(version) + }, +} + +func init() { + rootCmd.AddCommand(versionCmd) +}