Skip to content

Commit ab56caf

Browse files
committed
1 parent a54ad7a commit ab56caf

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed

.github/workflows/publish.yml

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,50 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
1+
# For more information see: https://docs.github.com/en/actions/how-tos/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-pypi
32

43
name: PyPI
54

65
on:
76
release:
8-
types: [created]
7+
types: [published]
98

109
jobs:
11-
deploy:
10+
release-build:
1211
runs-on: ubuntu-latest
1312

1413
steps:
15-
- uses: actions/checkout@v4
16-
- name: Set up Python
17-
uses: actions/setup-python@v5
18-
with:
19-
python-version: "3.x"
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install setuptools wheel twine build
24-
- name: Build and publish
25-
env:
26-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
27-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
28-
run: |
29-
python -m build --sdist --wheel .
30-
twine upload dist/*
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.x"
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install setuptools wheel build
24+
25+
- name: Build release distributions
26+
run: |
27+
python -m build --sdist --wheel .
28+
29+
- name: Upload release distributions
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: release-dists
33+
path: dist/
34+
35+
pypi-publish:
36+
runs-on: ubuntu-latest
37+
needs:
38+
- release-build
39+
permissions:
40+
id-token: write
41+
42+
steps:
43+
- name: Retrieve release distributions
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: release-dists
47+
path: dist/
48+
49+
- name: Publish release distributions to PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)