Skip to content

Commit 145c263

Browse files
authored
Use github action to increment tag versions on merge (#33)
1 parent 738f481 commit 145c263

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

.github/workflows/terraform-create-git-tag.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,26 @@ on:
1212
type: string
1313

1414
jobs:
15-
create_tag:
15+
build:
16+
if: github.event.pull_request.merged == true
1617
runs-on: ubuntu-latest
17-
18-
env:
19-
GIT_USER_NAME: "Infra Workleap"
20-
GIT_USER_EMAIL: "[email protected]"
21-
SOURCE_VERSION_MESSAGE: "Automated tag creation"
22-
18+
permissions:
19+
contents: write
2320
steps:
24-
- name: Checkout repository
25-
uses: actions/checkout@v4
21+
- uses: actions/checkout@v4
22+
with:
23+
ref: ${{ github.event.pull_request.merge_commit_sha }}
24+
fetch-depth: '0'
25+
26+
- name: Set git author
27+
run: |
28+
git config --global user.name "github-actions[bot]"
29+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
2630
27-
- name: Create Git Tag
28-
run: |
29-
echo "Creating tag [${buildVersion}] with message: ${{ env.SOURCE_VERSION_MESSAGE }}"
30-
git config --global user.name "${{ env.GIT_USER_NAME }}"
31-
git config --global user.email "${{ env.GIT_USER_EMAIL }}"
32-
git tag -a ${buildVersion} -m "${{ env.SOURCE_VERSION_MESSAGE }}"
33-
git push origin --tags
31+
- name: Bump version and push tag
32+
uses: anothrNick/github-tag-action@v1 # Don't use @master or @v1 unless you're happy to test the latest version
33+
env:
34+
DEFAULT_BUMP: patch
35+
INITIAL_VERSION: 1.0.0
36+
WITH_V: false
37+
PRERELEASE: false

0 commit comments

Comments
 (0)