Skip to content

Commit c1926a9

Browse files
Add create-release job to GitHub Actions workflow for automated releases
1 parent 306fd86 commit c1926a9

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

.github/workflows/test.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,41 @@ jobs:
7070
- name: Run tests with built wheel
7171
run: uv run --with dist/*.whl --with pytest pytest testing --color=yes
7272

73+
create-release:
74+
name: Create GitHub Release
75+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
76+
needs: [test, build-and-inspect]
77+
runs-on: ubuntu-latest
78+
permissions:
79+
contents: write
80+
81+
steps:
82+
- name: Download built packages
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: Packages
86+
path: dist
87+
88+
- name: Extract version from tag
89+
id: version
90+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
91+
92+
- name: Create GitHub Release
93+
uses: softprops/action-gh-release@v2
94+
with:
95+
files: dist/*
96+
fail_on_unmatched_files: true
97+
generate_release_notes: true
98+
name: Version ${{ steps.version.outputs.VERSION }}
99+
73100
publish-to-pypi:
74101
name: Publish to PyPI
75-
if: github.event_name == 'push' && github.event.action == 'published'
76-
needs: [test, build-and-inspect]
102+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
103+
needs: [test, build-and-inspect, create-release]
77104
runs-on: ubuntu-latest
78105
environment: pypi-upload
79106
permissions:
80107
id-token: write
81-
attestations: write
82108

83109
steps:
84110
- name: Download built packages

0 commit comments

Comments
 (0)