Skip to content

Commit 3a8451e

Browse files
committed
ci: auto-create GitHub Release on tag push
- Extract changelog notes for tagged version - Create release with .whl artifact - Add installation instructions
1 parent b5d3a46 commit 3a8451e

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
permissions:
1212
id-token: write # Required for trusted publishing
13+
contents: write # Required for creating releases
1314

1415
steps:
1516
- uses: actions/checkout@v4
@@ -40,3 +41,37 @@ jobs:
4041

4142
- name: Publish to PyPI
4243
uses: pypa/gh-action-pypi-publish@release/v1
44+
45+
- name: Extract version from tag
46+
id: version
47+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
48+
49+
- name: Extract changelog for this version
50+
id: changelog
51+
run: |
52+
# Extract the section for this version from CHANGELOG.md
53+
VERSION="${{ steps.version.outputs.VERSION }}"
54+
# Get content between this version header and the next --- or ## [
55+
NOTES=$(awk "/^## \[${VERSION}\]/{flag=1; next} /^---$|^## \[/{flag=0} flag" CHANGELOG.md)
56+
# Handle multi-line output
57+
echo "NOTES<<EOF" >> $GITHUB_OUTPUT
58+
echo "$NOTES" >> $GITHUB_OUTPUT
59+
echo "EOF" >> $GITHUB_OUTPUT
60+
61+
- name: Create GitHub Release
62+
uses: softprops/action-gh-release@v2
63+
with:
64+
name: v${{ steps.version.outputs.VERSION }}
65+
body: |
66+
## What's Changed
67+
68+
${{ steps.changelog.outputs.NOTES }}
69+
70+
## Installation
71+
72+
```bash
73+
pip install quorum-cli==${{ steps.version.outputs.VERSION }}
74+
```
75+
76+
See [CHANGELOG.md](https://github.com/Detrol/quorum-cli/blob/main/CHANGELOG.md) for full history.
77+
files: dist/*.whl

0 commit comments

Comments
 (0)