-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: publish package to PyPI using OIDC (#350)
Fixes #349
- Loading branch information
Showing
1 changed file
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,11 +25,32 @@ jobs: | |
run: python3 -m build | ||
|
||
- name: Check | ||
run: twine check dist/* | ||
run: twine check --strict dist/* | ||
|
||
- name: Publish | ||
- name: Upload packages artifact | ||
if: github.event_name == 'release' | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: twine upload dist/* | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-packages | ||
path: dist/ | ||
|
||
publish: | ||
if: github.event_name == 'release' | ||
needs: [build] | ||
|
||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/hcloud | ||
permissions: | ||
id-token: write | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download packages artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-packages | ||
path: dist/ | ||
|
||
- name: Publish packages to PyPI | ||
uses: pypa/[email protected] |