diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 11ebd76..9051ebb 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -17,6 +17,10 @@ builds: ignore: - goos: windows goarch: "386" + # Custom ldflags templates. + # Default is `-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser`. + ldflags: + - -s -w -X github.com/abs3ntdev/haunt/cmd.Version={{.Version}} archives: - format: tar.gz diff --git a/.woodpecker.yml b/.woodpecker.yml index 49f6a84..1ea2580 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -4,10 +4,9 @@ pipeline: commands: - go mod tidy - go build -o bin/haunt - - mkdir completions - - ./bin/haunt completion zsh > completions/haunt_zsh - - ./bin/haunt completion bash > completions/haunt_bash - - ./bin/haunt completion fish > completions/haunt_fish + when: + event: push + publish: image: goreleaser/goreleaser commands: diff --git a/cmd/version.go b/cmd/version.go index c08c037..6227fc9 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -7,6 +7,8 @@ import ( "github.com/spf13/cobra" ) +var Version = "dev" + // versionCmd represents the version command var versionCmd = &cobra.Command{ Use: "version", @@ -37,5 +39,5 @@ func init() { // Version print current version func version(cmd *cobra.Command, args []string) { r := haunt.NewHaunt() - log.Println(r.Prefix(haunt.Green.Bold(haunt.RVersion))) + log.Println(r.Prefix(haunt.Green.Bold(Version))) } diff --git a/haunt b/haunt new file mode 100755 index 0000000..066bb7c Binary files /dev/null and b/haunt differ diff --git a/src/haunt/cli.go b/src/haunt/cli.go index bedd44f..26698b7 100644 --- a/src/haunt/cli.go +++ b/src/haunt/cli.go @@ -18,8 +18,6 @@ import ( var ( // RPrefix tool name RPrefix = "haunt" - // RVersion current version - RVersion = "v0.1.3" // RExt file extension RExt = ".yaml" // RFile config file name