Skip to content

Commit 65a9ac2

Browse files
committed
ci: improve auto-release workflow with version extraction and release notes
1 parent 15e3377 commit 65a9ac2

File tree

1 file changed

+73
-29
lines changed

1 file changed

+73
-29
lines changed

.github/workflows/auto-release.yml

Lines changed: 73 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,84 @@ name: Auto Release
22

33
on:
44
push:
5-
branches: [main]
65
tags:
7-
- 'v*'
6+
- 'v*.*.*'
87

98
permissions:
109
contents: write
10+
packages: write
11+
id-token: write
1112

1213
jobs:
13-
release:
14+
auto-release:
1415
runs-on: ubuntu-latest
15-
if: startsWith(github.ref, 'refs/tags/v')
16+
1617
steps:
17-
- uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0
20-
21-
- uses: actions/setup-python@v5
22-
with:
23-
python-version: '3.13'
24-
25-
- name: Install build tools
26-
run: pip install build twine
27-
28-
- name: Build package
29-
run: python -m build
30-
31-
- name: Publish to PyPI
32-
env:
33-
TWINE_USERNAME: __token__
34-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
35-
run: twine upload dist/*
36-
37-
- name: Create GitHub Release
38-
uses: softprops/action-gh-release@v1
39-
with:
40-
files: dist/*
41-
generate_release_notes: true
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: "3.11"
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install build twine
33+
34+
- name: Extract version from tag
35+
id: get_version
36+
run: |
37+
VERSION=${GITHUB_REF#refs/tags/v}
38+
echo "version=$VERSION" >> $GITHUB_OUTPUT
39+
echo "Version: $VERSION"
40+
41+
- name: Build package
42+
run: |
43+
python -m build
44+
45+
- name: Publish to PyPI
46+
env:
47+
TWINE_USERNAME: __token__
48+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
49+
run: |
50+
twine upload dist/*
51+
52+
- name: Create GitHub Release
53+
uses: actions/create-release@v1
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
with:
57+
tag_name: ${{ github.ref }}
58+
release_name: strands-erc8004 v${{ steps.get_version.outputs.version }}
59+
body: |
60+
## 📄 strands-erc8004 v${{ steps.get_version.outputs.version }}
61+
62+
### 📦 Installation
63+
```bash
64+
pip install strands-erc8004==${{ steps.get_version.outputs.version }}
65+
```
66+
67+
### 🔄 Upgrade
68+
```bash
69+
pip install --upgrade strands-erc8004
70+
```
71+
72+
### 📋 Changes
73+
This release includes the latest changes tagged as v${{ steps.get_version.outputs.version }}.
74+
75+
**Full Changelog**: https://github.com/cagataycali/strands-erc8004/releases
76+
draft: false
77+
prerelease: false
78+
79+
- name: Summary
80+
run: |
81+
echo "## 🎉 Release Summary" >> $GITHUB_STEP_SUMMARY
82+
echo "" >> $GITHUB_STEP_SUMMARY
83+
echo "- **Version:** v${{ steps.get_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
84+
echo "- **PyPI:** https://pypi.org/project/strands-erc8004/${{ steps.get_version.outputs.version }}/" >> $GITHUB_STEP_SUMMARY
85+
echo "- **GitHub Release:** https://github.com/cagataycali/strands-erc8004/releases/tag/v${{ steps.get_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)