Skip to content

Commit cf2496c

Browse files
committed
ci(pypi): split the PyPI release process
Related to packit/private#32 Signed-off-by: Matej Focko <[email protected]>
1 parent 875f03e commit cf2496c

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,57 @@ name: Publish Python 🐍 distributions 📦 to PyPI
55

66
on:
77
release:
8-
types: [published]
8+
types: [released]
99

1010
jobs:
11-
build-n-publish:
11+
build:
12+
name: Build distribution 📦
1213
runs-on: ubuntu-latest
13-
permissions:
14-
id-token: write # for trusted publishing
1514

1615
steps:
17-
- uses: actions/checkout@v3
18-
- uses: actions/setup-python@v4
16+
- uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
19+
20+
- uses: actions/setup-python@v5
21+
22+
- name: Get history and tags for SCM versioning to work
23+
run: |
24+
git fetch --prune --unshallow
25+
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
1926
2027
- name: Build a source tarball and a binary wheel
2128
# https://pypa-build.readthedocs.io
2229
run: |
2330
python -m pip install build
2431
python -m build
2532
33+
- name: Store the distribution packages
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: python-package-distributions
37+
path: dist/
38+
39+
publish:
40+
name: Publish Python 🐍 distribution 📦 to PyPI
41+
needs:
42+
- build
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: pypi
46+
url: https://pypi.org/project/specfile/
47+
permissions:
48+
id-token: write # for trusted publishing
49+
50+
steps:
51+
- name: Download all the dists
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: python-package-distributions
55+
path: dist/
56+
2657
- name: Publish 📦 to PyPI
2758
# https://github.com/pypa/gh-action-pypi-publish
2859
uses: pypa/gh-action-pypi-publish@release/v1
2960
with:
30-
verbose: true
61+
verbose: true

0 commit comments

Comments
 (0)