Skip to content

Commit

Permalink
Update version by goreleaser (#191)
Browse files Browse the repository at this point in the history
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
  • Loading branch information
zhuwenxing authored and yelusion2 committed Oct 16, 2023
1 parent f4b295c commit 2a836fc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
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()
}

0 comments on commit 2a836fc

Please sign in to comment.