Skip to content

Commit 89b1b4a

Browse files
committed
setup trusted publishing to pypi
1 parent 0b33d1e commit 89b1b4a

File tree

1 file changed

+35
-9
lines changed

1 file changed

+35
-9
lines changed

.github/workflows/build_wheel.yml

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
python-version: "3.10"
2929
- name: Build wheel
3030
run: |
31-
pip install wheel
32-
python setup.py bdist_wheel
33-
31+
pip install wheel
32+
python setup.py bdist_wheel
33+
3434
- name: Upload wheel artifact
3535
uses: actions/upload-artifact@v4
3636
with:
@@ -52,8 +52,8 @@ jobs:
5252
python-version: "3.12"
5353
- name: Build sdist
5454
run: |
55-
pip install build
56-
python -m build --sdist --outdir ./dist
55+
pip install build
56+
python -m build --sdist --outdir ./dist
5757
- name: Upload sdist artifact
5858
uses: actions/upload-artifact@v4
5959
with:
@@ -65,12 +65,19 @@ jobs:
6565
strategy:
6666
fail-fast: false
6767
matrix:
68-
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-latest]
68+
os:
69+
[
70+
ubuntu-latest,
71+
ubuntu-24.04-arm,
72+
windows-latest,
73+
macos-13,
74+
macos-latest,
75+
]
6976
steps:
7077
- name: Checkout repo
7178
uses: actions/checkout@v5
7279
with:
73-
submodules: true
80+
submodules: true
7481
- name: Build wheels
7582
uses: pypa/[email protected]
7683
with:
@@ -106,11 +113,30 @@ jobs:
106113
path: dist
107114
pattern: swmm-toolkit-*dist*
108115
merge-multiple: true
109-
116+
110117
- name: Upload consolidated archive
111118
uses: actions/upload-artifact@v4
112119
with:
113120
name: swmm_toolkit_dist
114121
path: ./dist/*
115122

116-
123+
publish_toolkit:
124+
name: Publish Python 🐍 distribution 📦 to PyPI
125+
needs:
126+
- merge_wheels
127+
# only publish to PyPI on tag pushes
128+
if: startsWith(github.ref, 'refs/tags/')
129+
runs-on: ubuntu-latest
130+
environment:
131+
name: pypi
132+
url: https://pypi.org/p/swmm-toolkit
133+
permissions:
134+
id-token: write
135+
steps:
136+
- name: Download all the dists
137+
uses: actions/download-artifact@v5
138+
with:
139+
name: swmm_toolkit_dist
140+
path: dist/
141+
- name: Publish distribution 📦 to PyPI
142+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)