Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update version by goreleaser #191

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ builds:
goos:
- linux
- darwin
ldflags:
- -w -s
- -X main.version={{ .Version }}
- -X main.commit={{ .Commit }}
- -X main.date={{ .Date }}

archives:
- format: tar.gz
Expand All @@ -25,6 +30,9 @@ checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"



changelog:
sort: asc
use: github
Expand Down
6 changes: 6 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package cmd

import (
"errors"
"fmt"

"github.com/spf13/cobra"
)

Expand All @@ -23,3 +25,7 @@ func Execute() {

rootCmd.Execute()
}

func SetVersionInfo(version, commit, date string) {
rootCmd.Version = fmt.Sprintf("%s (Built on %s from Git SHA %s)", version, date, commit)
}
20 changes: 0 additions & 20 deletions cmd/version.go

This file was deleted.

7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import (
_ "github.com/zilliztech/milvus-backup/docs"
)

var (
version = "dev"
commit = "unknown"
date = "unknown"
)

// @title Milvus Backup Service
// @version 1.0
// @description A data backup & restore tool for Milvus
Expand All @@ -14,5 +20,6 @@ import (
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @BasePath /api/v1
func main() {
cmd.SetVersionInfo(version, commit, date)
cmd.Execute()
}