Skip to content

Commit

Permalink
✨ feat: add version metadata including revision, date and commit hash
Browse files Browse the repository at this point in the history
  • Loading branch information
watzon committed Nov 22, 2024
1 parent d1214e5 commit 2a96c31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 2a96c31

Please sign in to comment.