From 747e9d5e06e80777842598a95527d11ca0e5fe40 Mon Sep 17 00:00:00 2001 From: Dezydery Czuprynski Date: Thu, 19 Sep 2024 09:43:31 +0200 Subject: [PATCH 1/2] Fix tagging on deploy by assigning higher permissions on action --- .github/workflows/maven.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 8dc39e1..b22e89f 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -91,8 +91,6 @@ jobs: needs: - build - calc_version - env: - version: ${{ needs.calc_version.outputs.version }} environment: Deployment_manual steps: - name: Configure Signing Key @@ -112,7 +110,23 @@ jobs: server-password: NEXUS_PASSWORD - name: Deploy to SonaType run: mvn deploy - - name: Tag repository - run: | - git tag $version - git push origin $version + + release: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: + - calc_version + - deploy + permissions: + contents: write + steps: + - name: Create tag + uses: actions/github-script@v7 + with: + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/${{ needs.calc_version.outputs.version }}', + sha: context.sha + }) From c40dfa22383518c371d2cb289732d1e8a54addcb Mon Sep 17 00:00:00 2001 From: Dezydery Czuprynski Date: Thu, 19 Sep 2024 09:56:39 +0200 Subject: [PATCH 2/2] Rename job --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index b22e89f..a091951 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -111,7 +111,7 @@ jobs: - name: Deploy to SonaType run: mvn deploy - release: + post_deploy_tagging: if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest needs: