Skip to content

Commit

Permalink
ci(release-wkflow): harden flaws & improve release job definition
Browse files Browse the repository at this point in the history
  • Loading branch information
codejedi365 committed Sep 30, 2024
1 parent 658f7d6 commit f1332e4
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,30 @@ jobs:

release:
name: Semantic Release
concurrency: release
runs-on: ubuntu-latest
concurrency: push
needs: [build]
if: github.repository == 'python-semantic-release/publish-action'
needs:
- validate

permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v4
# Note: we need to checkout the repository at the workflow sha in case during the workflow
# the branch was updated. To keep PSR working with the configured release branches,
# we force a checkout of the desired release branch but at the workflow sha HEAD.
- name: Setup | Checkout Repository at workflow sha
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
ref: ${{ github.sha }}

- name: Python Semantic Release
- name: Setup | Force correct release branch on workflow sha
run: |
git checkout -B ${{ github.ref_name }}
- name: Release | Python Semantic Release
id: release
uses: python-semantic-release/[email protected]
with:
Expand All @@ -58,7 +67,7 @@ jobs:
prerelease: ${{ github.event.inputs.as-prerelease }}
changelog: false

- name: Update Minor Release Tag Reference
- name: Release | Update Minor Release Tag Reference
if: steps.release.outputs.released == 'true' && steps.release.outputs.is_prerelease == 'false'
env:
FULL_VERSION_TAG: ${{ steps.release.outputs.tag }}
Expand All @@ -67,7 +76,7 @@ jobs:
git tag --force --annotate "$MINOR_VERSION_TAG" "${FULL_VERSION_TAG}^{}" -m "$MINOR_VERSION_TAG"
git push origin "$MINOR_VERSION_TAG" --force
- name: Update Major Release Tag Reference
- name: Release | Update Major Release Tag Reference
if: steps.release.outputs.released == 'true' && steps.release.outputs.is_prerelease == 'false'
env:
FULL_VERSION_TAG: ${{ steps.release.outputs.tag }}
Expand Down

0 comments on commit f1332e4

Please sign in to comment.