From 534c4f83ad38caa93ee2521af36533a22cdbea61 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 3 Jan 2023 22:30:23 +0100 Subject: [PATCH] ci(build): add version number on build --- .woodpecker.yml | 4 ++-- main.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index aa1e861..341bc84 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,6 +2,8 @@ pipeline: tests: image: golang:1.18 commands: + - test -n "$CI_COMMIT_TAG" && sed "s/{app_version}/$CI_COMMIT_TAG/g" -i main.go || true + - test -n "$CI_COMMIT_SHA" && sed "s/{app_version}/${CI_COMMIT_TAG:0:7}/g" -i main.go || true - make test build_push_latest_gitnet: @@ -16,7 +18,6 @@ pipeline: password: from_secret: registry_password when: - branch: [master, develop, feature/*] event: [push] build_push_tag_gitnet: @@ -44,7 +45,6 @@ pipeline: password: from_secret: registry_docker_password when: - branch: [master] event: [push] build_push_tag_dhub: diff --git a/main.go b/main.go index ff6c9b8..efea55e 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,7 @@ func main() { app.Name = "email plugin" app.Usage = "email plugin" app.Action = run - app.Version = "2.0.2" + app.Version = "{app_version}" app.Flags = []cli.Flag{ // Plugin environment cli.StringFlag{