From 145c2633ebde0d88337d61d665caf17eb9241ae2 Mon Sep 17 00:00:00 2001 From: Tristan Date: Fri, 27 Sep 2024 10:23:05 -0400 Subject: [PATCH] Use github action to increment tag versions on merge (#33) --- .../workflows/terraform-create-git-tag.yml | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/terraform-create-git-tag.yml b/.github/workflows/terraform-create-git-tag.yml index d8790ba..857e3eb 100644 --- a/.github/workflows/terraform-create-git-tag.yml +++ b/.github/workflows/terraform-create-git-tag.yml @@ -12,22 +12,26 @@ on: type: string jobs: - create_tag: + build: + if: github.event.pull_request.merged == true runs-on: ubuntu-latest - - env: - GIT_USER_NAME: "Infra Workleap" - GIT_USER_EMAIL: "infra@workleap.com" - SOURCE_VERSION_MESSAGE: "Automated tag creation" - + permissions: + contents: write steps: - - name: Checkout repository - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.merge_commit_sha }} + fetch-depth: '0' + + - name: Set git author + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" - - name: Create Git Tag - run: | - echo "Creating tag [${buildVersion}] with message: ${{ env.SOURCE_VERSION_MESSAGE }}" - git config --global user.name "${{ env.GIT_USER_NAME }}" - git config --global user.email "${{ env.GIT_USER_EMAIL }}" - git tag -a ${buildVersion} -m "${{ env.SOURCE_VERSION_MESSAGE }}" - git push origin --tags + - name: Bump version and push tag + uses: anothrNick/github-tag-action@v1 # Don't use @master or @v1 unless you're happy to test the latest version + env: + DEFAULT_BUMP: patch + INITIAL_VERSION: 1.0.0 + WITH_V: false + PRERELEASE: false