-
Notifications
You must be signed in to change notification settings - Fork 18
Switch to Trusted Publishing for PyPI packages #201
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
base: master
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -8,11 +8,14 @@ on: | |
| push: | ||
| tags: | ||
| - '*/v*' | ||
|
|
||
| jobs: | ||
| build-publish: | ||
|
|
||
| runs-on: ubuntu-latest | ||
| environment: publish | ||
| permissions: | ||
| id-token: write | ||
|
Comment on lines
+17
to
+18
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This permission is required for the publish action: https://github.com/pypa/gh-action-pypi-publish |
||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
@@ -33,20 +36,17 @@ jobs: | |
| - name: Install dependencies | ||
| run: | | ||
| cd $PACKAGE_NAME | ||
| pip install twine uv | ||
| pip install uv | ||
|
|
||
| - name: Build wheel | ||
| run: | | ||
| cd $PACKAGE_NAME | ||
| uv build | ||
|
|
||
| - name: Publish distribution to PyPI | ||
| env: | ||
| TWINE_USERNAME: __token__ | ||
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
| run: | | ||
| cd $PACKAGE_NAME | ||
| twine upload --repository pypi dist/* | ||
| - name: Publish distribution to PyPI 🚀 | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| package-dir: ./${{ env.PACKAGE_NAME }}/dist/ | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default package-dir is |
||
|
|
||
| - name: Create Release | ||
| id: create_release | ||
|
|
||
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.
This is not strictly required, but PyPI recommends setting the environment: