Skip to content

Commit

Permalink
Separated building and publishing to different jobs
Browse files Browse the repository at this point in the history
This is the PyPA recommended practice to protect the token from compromised code during the build phase.
  • Loading branch information
agronholm committed Jul 29, 2023
1 parent cc5cc54 commit 2a5ef72
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ on:
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"

jobs:
publish:
build:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand All @@ -24,5 +22,20 @@ jobs:
run: pip install build
- name: Create packages
run: python -m build
- name: Archive packages
uses: actions/upload-artifact@v3
with:
name: dist
path: dist

publish:
needs: build
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- name: Retrieve packages
uses: actions/download-artifact@v3
- name: Upload packages
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 2a5ef72

Please sign in to comment.