diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65f1ff8..cf068bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,12 @@ jobs: ref: main - name: Update version run: | + COMMIT=$(git rev-parse HEAD) + DATE=$(date -u +"%Y-%m-%d") sed -i "s/const Version = \".*\"/const Version = \"${GITHUB_REF_NAME}\"/" pkg/version/version.go + sed -i "s/const Revision = \".*\"/const Revision = \"${GITHUB_SHA}\"/" pkg/version/version.go + sed -i "s/const Date = \".*\"/const Date = \"${DATE}\"/" pkg/version/version.go + sed -i "s/const Commit = \".*\"/const Commit = \"${COMMIT}\"/" pkg/version/version.go git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" git add pkg/version/version.go diff --git a/pkg/version/version.go b/pkg/version/version.go index 332b544..40cc29e 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -2,3 +2,12 @@ package version // Version is the current version of goshot const Version = "v0.4.4" + +// Revision is the current git revision of goshot +const Revision = "HEAD" + +// Date is the build date of goshot +const Date = "unknown" + +// Commit is the git commit of goshot +const Commit = "unknown"