Skip to content

Commit 12405c2

Browse files
committed
Improve pypi release process
1 parent 6cc30ad commit 12405c2

File tree

1 file changed

+13
-24
lines changed

1 file changed

+13
-24
lines changed

.github/workflows/pypi-release.yaml

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
release:
55
types:
66
- published
7-
push:
8-
tags:
9-
- 'v*'
107

118
jobs:
129
build-artifacts:
@@ -20,52 +17,43 @@ jobs:
2017
name: Install Python
2118
with:
2219
python-version: "3.11"
23-
24-
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
python -m pip install build twine
2820
- name: Build tarball and wheels
2921
run: |
3022
git clean -xdf
3123
git restore -SW .
32-
python -m build
24+
pipx run build
25+
- name: List contents of built dist
26+
run: |
27+
ls -ltrh
28+
ls -ltrh dist
3329
- name: Check built artifacts
3430
run: |
35-
python -m twine check --strict dist/*
31+
pipx run twine check --strict dist/*
3632
pwd
3733
if [ -f dist/numpy_groupies-0.0.0.tar.gz ]; then
3834
echo "❌ INVALID VERSION NUMBER"
3935
exit 1
4036
else
4137
echo "✅ Looks good"
4238
fi
39+
- name: Test artifact installation
40+
run: |
41+
python -m pip install --upgrade pip
42+
python -m pip install dist/*.tar.gz
4343
- uses: actions/upload-artifact@v4
4444
with:
45+
name: release
4546
path: dist
4647

4748
test-built-dist:
4849
needs: build-artifacts
4950
runs-on: ubuntu-latest
5051
steps:
51-
- uses: actions/setup-python@v5
52-
name: Install Python
53-
with:
54-
python-version: "3.11"
5552
- uses: actions/download-artifact@v4
5653
with:
54+
name: release
5755
path: dist
58-
- name: List contents of built dist
59-
run: |
60-
ls -ltrh
61-
ls -ltrh dist
62-
- name: Verify the built dist/wheel is valid
63-
if: github.event_name == 'push'
64-
run: |
65-
python -m pip install --upgrade pip
66-
python -m pip install dist/*.tar.gz
6756
- name: Publish package to TestPyPI
68-
if: github.event_name == 'push'
6957
uses: pypa/gh-action-pypi-publish@release/v1
7058
with:
7159
password: ${{ secrets.TESTPYPI_TOKEN }}
@@ -79,6 +67,7 @@ jobs:
7967
steps:
8068
- uses: actions/download-artifact@v4
8169
with:
70+
name: release
8271
path: dist
8372
- name: Publish package to PyPI
8473
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)