Skip to content

Commit 44d6c67

Browse files
committed
fix: Fix Python release workflow
1 parent 93e9816 commit 44d6c67

File tree

1 file changed

+62
-4
lines changed

1 file changed

+62
-4
lines changed

.github/workflows/python-package.yaml

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- "v*.*.*"
99

1010
jobs:
11-
release:
11+
build:
1212
runs-on: ubuntu-latest
1313
if: startsWith(github.ref, 'refs/tags/v')
1414

@@ -30,6 +30,23 @@ jobs:
3030
run: |
3131
python setup.py sdist bdist_wheel
3232
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-to-pypi:
40+
name: Publish to PyPI
41+
needs: build
42+
runs-on: ubuntu-latest
43+
permissions:
44+
id-token: write
45+
contents: write
46+
environment:
47+
name: pypi
48+
url: https://pypi.org/p/anybadge
49+
steps:
3350
- name: Upload package to PyPI
3451
uses: pypa/gh-action-pypi-publish@release/v1
3552
with:
@@ -44,6 +61,47 @@ jobs:
4461
env:
4562
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4663

47-
- name: Clean up
48-
run: |
49-
rm -rf dist
64+
github-release:
65+
name: >-
66+
Sign the Python 🐍 distribution 📦 with Sigstore
67+
and upload them to GitHub Release
68+
needs:
69+
- publish-to-pypi
70+
runs-on: ubuntu-latest
71+
72+
permissions:
73+
contents: write
74+
id-token: write
75+
76+
steps:
77+
- name: Download all the dists
78+
uses: actions/download-artifact@v4
79+
with:
80+
name: python-package-distributions
81+
path: dist/
82+
- name: Sign the dists with Sigstore
83+
uses: sigstore/gh-action-sigstore-python@v3.0.0
84+
with:
85+
inputs: >-
86+
./dist/*.tar.gz
87+
./dist/*.whl
88+
- name: Create GitHub Release
89+
env:
90+
GITHUB_TOKEN: ${{ github.token }}
91+
run: >-
92+
gh release create
93+
"$GITHUB_REF_NAME"
94+
--repo "$GITHUB_REPOSITORY"
95+
--notes ""
96+
- name: Upload artifact signatures to GitHub Release
97+
env:
98+
GITHUB_TOKEN: ${{ github.token }}
99+
# Upload to GitHub Release using the `gh` CLI.
100+
# `dist/` contains the built packages, and the
101+
# sigstore-produced signatures and certificates.
102+
run: >-
103+
gh release upload
104+
"$GITHUB_REF_NAME" dist/**
105+
--repo "$GITHUB_REPOSITORY"
106+
- name: Cleanup
107+
run: rm -rf dist/

0 commit comments

Comments
 (0)