Skip to content

Commit 6d8fa4c

Browse files
committed
Add Git tagging step to build workflow for automated versioning
1 parent 1825079 commit 6d8fa4c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ jobs:
3434
run: x86_64-w64-mingw32-strip build/ghostinjector-*.exe
3535
- name: Rename executable
3636
run: mv build/ghostinjector-*.exe build/ghostinjector.exe
37+
38+
- name: Create Git Tag with Commit Message
39+
if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || startsWith(github.ref, 'refs/tags/v')
40+
run: |
41+
TAG_NAME="${{ (github.ref == 'refs/heads/main' && 'latest') || github.ref_name }}"
42+
COMMIT_MSG=$(git log -1 --pretty=%B)
43+
git config user.name "github-actions"
44+
git config user.email "github-actions@github.com"
45+
git tag -a "$TAG_NAME" -m "$COMMIT_MSG" -f
46+
git push origin "$TAG_NAME" -f
3747
3848
- name: Create Release
3949
if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || startsWith(github.ref, 'refs/tags/v')

0 commit comments

Comments
 (0)