Skip to content

Commit 6498b2f

Browse files
feat: github release workflow
1 parent adaee5e commit 6498b2f

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*' # Trigger on version tags like v1.0.0
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Extract Release Notes
18+
id: extract_notes
19+
run: |
20+
VERSION="${GITHUB_REF#refs/tags/}"
21+
22+
# Use awk to extract content between the target version and the next header
23+
# - matches "## [VERSION]" (even if it has a date like " - 2026-04-28")
24+
# - stops at the next "## ["
25+
awk -v ver="[$VERSION]" '/^## / { if (p) exit; if ($2 ~ ver) p=1; next } p' CHANGELOG.md > release_notes.md
26+
27+
# Check if notes were found
28+
if [ ! -s release_notes.md ]; then
29+
echo "No notes found for version $VERSION"
30+
echo "Release $VERSION" > release_notes.md
31+
fi
32+
33+
- name: Create Release
34+
uses: softprops/action-gh-release@v2
35+
with:
36+
body_path: release_notes.md
37+
draft: false
38+
prerelease: false
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.pyc
22
__pycache__
33
.cache
4+
release_notes.md

0 commit comments

Comments
 (0)