Skip to content

Commit

Permalink
Fix release workflow permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed May 14, 2024
1 parent c743bf8 commit 1285158
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions .github/workflows/build-hatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,27 @@ jobs:
path: dist/*
if-no-files-found: error

publish-pypi:
name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: python-artifacts
runs-on: ubuntu-latest

permissions:
id-token: write

steps:
- name: Download Python artifacts
uses: actions/download-artifact@v4
with:
name: python-artifacts
path: dist

- name: Push Python artifacts to PyPI
uses: pypa/[email protected]
with:
skip-existing: true

binaries:
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
needs:
Expand Down Expand Up @@ -486,23 +507,13 @@ jobs:
path: signed/${{ steps.pkg.outputs.path }}
if-no-files-found: error

publish-pypi:
name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: python-artifacts
runs-on: ubuntu-latest

steps:
- name: Download Python artifacts
uses: actions/download-artifact@v4
with:
name: python-artifacts
path: dist

- name: Push Python artifacts to PyPI
uses: pypa/[email protected]
with:
skip-existing: true
distributions-dev:
name: Build development distributions
if: ${{ !startsWith(github.event.ref, 'refs/tags') }}
uses: ./.github/workflows/build-distributions.yml
# This actually does not need the binary jobs but we want to prioritize
# resources for the test jobs therefore this forces these later on
needs: binaries

distributions-release:
name: Build release distributions
Expand All @@ -514,14 +525,6 @@ jobs:
with:
version: ${{ needs.python-artifacts.outputs.version }}

distributions-dev:
name: Build development distributions
if: ${{ !startsWith(github.event.ref, 'refs/tags') }}
uses: ./.github/workflows/build-distributions.yml
# This actually does not need the binary jobs but we want to prioritize
# resources for the test jobs therefore this forces these later on
needs: binaries

publish-release:
name: Publish distributions
if: startsWith(github.event.ref, 'refs/tags')
Expand Down

0 comments on commit 1285158

Please sign in to comment.