File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33on :
44 push :
55 branches : [main]
6+ tags : ["v*"] # also triggers on version tags (e.g. v1.3.0)
67 pull_request :
78 branches : [main]
89
5758 run : pip install -r requirements.txt
5859 - name : Run tests with coverage
5960 run : pytest testing/mock/ --cov=. --cov-report=term-missing --timeout=30
61+
62+ # ── Release ──────────────────────────────────────────────────────────────────
63+ # Triggered only on version tags (e.g. v1.3.0).
64+ # Runs after CI passes, extracts the changelog section, creates a GitHub Release.
65+ #
66+ # Usage:
67+ # git tag v1.3.0
68+ # git push origin v1.3.0
69+ release :
70+ name : GitHub Release
71+ if : startsWith(github.ref, 'refs/tags/v')
72+ needs : [lint, type-check, test, coverage]
73+ runs-on : ubuntu-latest
74+ permissions :
75+ contents : write
76+ steps :
77+ - uses : actions/checkout@v4
78+
79+ - name : Extract version from tag
80+ id : version
81+ run : echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
82+
83+ - name : Extract changelog for this version
84+ id : changelog
85+ run : |
86+ semver="${{ steps.version.outputs.tag }}"
87+ semver="${semver#v}"
88+ awk "/^## \[${semver}\]/{found=1; next} /^## \[/{if(found) exit} found" CHANGELOG.md > /tmp/release_notes.md
89+ cat /tmp/release_notes.md
90+
91+ - name : Create GitHub Release
92+ uses : softprops/action-gh-release@v2
93+ with :
94+ tag_name : ${{ steps.version.outputs.tag }}
95+ name : ${{ steps.version.outputs.tag }}
96+ body_path : /tmp/release_notes.md
You can’t perform that action at this time.
0 commit comments