From 2916783beaf87c29a32199d9f69b346974e78106 Mon Sep 17 00:00:00 2001 From: Jonas Franz Date: Mon, 19 Mar 2018 01:08:16 +0100 Subject: [PATCH] Add version to command Signed-off-by: Jonas Franz --- .drone.yml | 2 +- main.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 59d33cf..b6842b7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -23,7 +23,7 @@ pipeline: environment: GOPATH: /go commands: - - xgo -out gg-migrator --targets=windows/*,darwin/* + - xgo -out gg-migrator -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" --targets=windows/*,darwin/* when: event: [ tag ] gitea: diff --git a/main.go b/main.go index a07fcc1..aee1c44 100644 --- a/main.go +++ b/main.go @@ -5,12 +5,19 @@ import ( "github.com/urfave/cli" + "fmt" "git.jonasfranz.software/JonasFranzDEV/gitea-github-migrator/cmd" ) +var ( + version = "0.0.0" + build = "0" +) + func main() { app := cli.NewApp() - app.Name = "gg-migrator" + app.Name = "gitea-github-migrator" + app.Version = fmt.Sprintf("%s+%s", version, build) app.Usage = "GitHub to Gitea migrator for repositories" app.Description = `Migrate your GitHub repositories including issues to Gitea` app.Commands = cli.Commands{