-
Notifications
You must be signed in to change notification settings - Fork 0
Add PyPI publish workflow with reusable build-wheels #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,147 @@ | ||||||||
| name: Publish to PyPI | ||||||||
|
|
||||||||
| on: | ||||||||
| release: | ||||||||
| types: [published] | ||||||||
| push: | ||||||||
| tags: | ||||||||
| - 'v*' | ||||||||
| workflow_dispatch: | ||||||||
| inputs: | ||||||||
| target: | ||||||||
| description: 'Publish target' | ||||||||
| required: true | ||||||||
| default: 'testpypi' | ||||||||
| type: choice | ||||||||
| options: | ||||||||
| - testpypi | ||||||||
| - pypi | ||||||||
|
|
||||||||
| # Prevent duplicate runs when release creates a tag | ||||||||
| concurrency: | ||||||||
| group: publish-${{ github.ref }} | ||||||||
| cancel-in-progress: false | ||||||||
|
|
||||||||
| jobs: | ||||||||
| build: | ||||||||
| uses: ./.github/workflows/build-wheels.yml | ||||||||
|
|
||||||||
| build_sdist: | ||||||||
| name: Build source distribution | ||||||||
| runs-on: ubuntu-latest | ||||||||
|
|
||||||||
| steps: | ||||||||
| - uses: actions/checkout@v4 | ||||||||
| with: | ||||||||
| fetch-depth: 0 | ||||||||
|
|
||||||||
| - name: Set up Python | ||||||||
| uses: actions/setup-python@v5 | ||||||||
| with: | ||||||||
| python-version: "3.11" | ||||||||
|
|
||||||||
| - name: Install build dependencies | ||||||||
| run: | | ||||||||
| python -m pip install --upgrade pip | ||||||||
| pip install build setuptools-scm | ||||||||
|
|
||||||||
| - name: Build sdist | ||||||||
| run: python -m build --sdist | ||||||||
|
|
||||||||
| - name: Upload sdist | ||||||||
| uses: actions/upload-artifact@v4 | ||||||||
| with: | ||||||||
| name: sdist | ||||||||
| path: dist/*.tar.gz | ||||||||
|
||||||||
| path: dist/*.tar.gz | |
| path: dist/*.tar.gz | |
| retention-days: 5 |
Copilot
AI
Nov 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The publish jobs have id-token: write for OIDC authentication, but they may also need contents: read permission to properly interact with release artifacts and repository content when triggered by release events.
Consider adding:
permissions:
id-token: write
contents: read
Copilot
AI
Nov 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The publish jobs have id-token: write for OIDC authentication, but they may also need contents: read permission to properly interact with release artifacts and repository content when triggered by release events.
Consider adding:
permissions:
id-token: write
contents: read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
releasetrigger andpushwithtags: v*may fire simultaneously when a GitHub release is published (since releases create tags). This could result in duplicate workflow runs attempting to publish the same version to PyPI.Consider using only the
releasetrigger for production releases, or add logic to prevent duplicate publishes (e.g., using a workflow concurrency group or removing one of the triggers).