Skip to content

Commit aa16850

Browse files
committed
ci: make release pipeline consistent across TNR projects
1 parent 5ff379e commit aa16850

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

.github/workflows/python-publish.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build and Publish
33
on:
44
push:
55
branches: [main]
6-
tags: 'v*'
6+
tags: ['v*']
77
pull_request:
88
branches: [main]
99

@@ -37,10 +37,11 @@ jobs:
3737
with:
3838
name: python-package-distributions
3939
path: dist/
40+
4041
publish-to-pypi:
4142
name: >-
4243
Publish Python 🐍 distribution 📦 to PyPI
43-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
44+
if: github.ref_type == 'tag'
4445
needs:
4546
- build
4647
runs-on: ubuntu-latest
@@ -58,3 +59,37 @@ jobs:
5859

5960
- name: Publish distribution 📦 to PyPI
6061
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
62+
63+
- name: Store the (now signed) distribution packages
64+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
65+
with:
66+
name: python-package-distributions
67+
path: dist/
68+
overwrite: true
69+
70+
add-release-artifacts:
71+
if: github.ref_type == 'tag'
72+
needs:
73+
- publish-to-pypi
74+
name: >-
75+
Sign the Python 🐍 distribution 📦 with Sigstore
76+
and upload them to GitHub Release
77+
78+
runs-on: ubuntu-latest
79+
80+
permissions:
81+
contents: write
82+
id-token: write
83+
84+
steps:
85+
- name: Download all the dists
86+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
87+
with:
88+
name: python-package-distributions
89+
path: dist/
90+
91+
- name: Upload release files and signatures
92+
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
93+
with:
94+
files: |
95+
./dist/**

release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
set -euo pipefail
33

44
changelog_file="$(mktemp)"
5-
cz bump --changelog-to-stdout --git-output-to-stderr > "$changelog_file"
5+
cz bump "${CZ_BUMP_ARGS:-}" --changelog-to-stdout --git-output-to-stderr > "$changelog_file"
66

77
git push origin main
88
sleep 1
99
git push --tags
1010
sleep 1
11-
gh release create "v$(cz version -p)" --verify-tag -t "Release v$(cz version -p)" -F "$changelog_file"
11+
gh release create "v$(cz version -p)" --verify-tag -t "Release v$(cz version -p)" -d -F "$changelog_file"
1212
rm "$changelog_file"

0 commit comments

Comments
 (0)