Skip to content

Commit

Permalink
Merge pull request #58 from gravity9-tech/fix-tagging
Browse files Browse the repository at this point in the history
Fix tagging on deploy by assigning higher permissions on action
  • Loading branch information
meehaws authored Sep 19, 2024
2 parents 2217e1e + c40dfa2 commit 7cfd9ab
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ jobs:
needs:
- build
- calc_version
env:
version: ${{ needs.calc_version.outputs.version }}
environment: Deployment_manual
steps:
- name: Configure Signing Key
Expand All @@ -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

post_deploy_tagging:
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
})

0 comments on commit 7cfd9ab

Please sign in to comment.