Skip to content

Commit 4ec56e7

Browse files
committed
Update PyPi publishing workflow
Signed-off-by: Nicolas Bock <[email protected]>
1 parent 1f7fa20 commit 4ec56e7

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

.github/workflows/publish.yaml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
---
2-
32
name: Publish PyPI Package
43

54
on:
6-
release:
7-
types: [created]
5+
push:
86
workflow_dispatch:
97

108
jobs:
11-
publish:
9+
build:
1210
runs-on: ubuntu-latest
1311
name: Publish PyPI Package
1412
steps:
@@ -31,10 +29,41 @@ jobs:
3129
- name: Install tox
3230
run: sudo apt install --yes tox
3331

32+
- name: Install pypa
33+
run: |
34+
pip install build
35+
36+
- name: Store the distribution packages
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: python-package-distributions
40+
path: dist/
41+
3442
- name: Publish PyPI Package
3543
env:
3644
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
3745
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
3846
run: |
3947
tox -e pypi
4048
.tox/pypi/bin/twine upload .tox/pypi/dist/*
49+
50+
publish-to-pypi:
51+
name: Publish Python 🐍 distribution 📦 to PyPI
52+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
53+
needs:
54+
- build
55+
runs-on: ubuntu-latest
56+
environment:
57+
name: pypi
58+
url: https://pypi.org/p/ebuildtester
59+
permissions:
60+
id-token: write # IMPORTANT: mandatory for trusted publishing
61+
62+
steps:
63+
- name: Download all the dists
64+
uses: actions/download-artifact@v4
65+
with:
66+
name: python-package-distributions
67+
path: dist/
68+
- name: Publish distribution 📦 to PyPI
69+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)