Skip to content

Commit 1a0e93b

Browse files
authored
ci: publish package to PyPI using OIDC (#350)
Fixes #349
1 parent d365726 commit 1a0e93b

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,32 @@ jobs:
2525
run: python3 -m build
2626

2727
- name: Check
28-
run: twine check dist/*
28+
run: twine check --strict dist/*
2929

30-
- name: Publish
30+
- name: Upload packages artifact
3131
if: github.event_name == 'release'
32-
env:
33-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
34-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
35-
run: twine upload dist/*
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: python-packages
35+
path: dist/
36+
37+
publish:
38+
if: github.event_name == 'release'
39+
needs: [build]
40+
41+
environment:
42+
name: pypi
43+
url: https://pypi.org/p/hcloud
44+
permissions:
45+
id-token: write
46+
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Download packages artifact
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: python-packages
53+
path: dist/
54+
55+
- name: Publish packages to PyPI
56+
uses: pypa/gh-action-pypi-publish@v1.8.11

0 commit comments

Comments
 (0)