Skip to content

Commit faeb470

Browse files
committed
publish on tag
1 parent 232addd commit faeb470

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

.github/workflows/cd.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
push:
77
branches:
88
- main
9+
tags:
10+
- "v*.*.*"
911
release:
1012
types:
1113
- published
@@ -15,8 +17,6 @@ concurrency:
1517
cancel-in-progress: true
1618

1719
env:
18-
# Many color libraries just need this to be set to any value, but at least
19-
# one distinguishes color depth, where "3" -> "256-bit color".
2020
FORCE_COLOR: 3
2121

2222
jobs:
@@ -31,16 +31,36 @@ jobs:
3131

3232
- uses: hynek/build-and-inspect-python-package@v2
3333

34-
publish:
34+
release:
3535
needs: [dist]
36+
name: Create GitHub Release
37+
runs-on: ubuntu-latest
38+
if: startsWith(github.ref, 'refs/tags/v')
39+
permissions:
40+
contents: write
41+
42+
steps:
43+
- uses: actions/download-artifact@v4
44+
with:
45+
name: Packages
46+
path: dist
47+
48+
- name: Create Release
49+
uses: softprops/action-gh-release@v2
50+
with:
51+
files: dist/*
52+
generate_release_notes: true
53+
54+
publish:
55+
needs: [dist, release]
3656
name: Publish to PyPI
3757
environment: pypi
3858
permissions:
3959
id-token: write
4060
attestations: write
4161
contents: read
4262
runs-on: ubuntu-latest
43-
if: github.event_name == 'release' && github.event.action == 'published'
63+
if: startsWith(github.ref, 'refs/tags/v')
4464

4565
steps:
4666
- uses: actions/download-artifact@v4
@@ -55,6 +75,4 @@ jobs:
5575

5676
- uses: pypa/gh-action-pypi-publish@release/v1
5777
with:
58-
# Remember to tell (test-)pypi about this repo before publishing
59-
# Remove this line to publish to PyPI
6078
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)