Skip to content

Commit 1062b1a

Browse files
chore(ci): add GitHub Actions workflow for automated release and changelog generation
1 parent c23d1b0 commit 1062b1a

2 files changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
permissions:
9+
contents: write
10+
id-token: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- uses: astral-sh/setup-uv@v4
21+
22+
- name: Build
23+
run: uv build
24+
25+
- name: Generate changelog
26+
uses: orhun/git-cliff-action@v3
27+
id: cliff
28+
with:
29+
config: cliff.toml
30+
args: --latest --strip header
31+
env:
32+
OUTPUT: CHANGES.md
33+
34+
- name: Create GitHub Release
35+
uses: softprops/action-gh-release@v2
36+
with:
37+
body_path: CHANGES.md
38+
files: dist/*
39+
40+
- name: Publish to PyPI
41+
uses: pypa/gh-action-pypi-publish@release/v1

cliff.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[changelog]
2+
header = "# Changelog\n\n"
3+
body = """
4+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
5+
{% for group, commits in commits | group_by(attribute="group") %}
6+
### {{ group | striptags | trim | upper_first }}
7+
{% for commit in commits %}
8+
- {{ commit.message | upper_first }}
9+
{% endfor %}
10+
{% endfor %}
11+
"""
12+
trim = true
13+
14+
[git]
15+
conventional_commits = true
16+
commit_parsers = [
17+
{ message = "^feat", group = "Features" },
18+
{ message = "^fix", group = "Bug fixes" },
19+
{ message = "^docs", group = "Documentation" },
20+
{ message = "^perf", group = "Performance" },
21+
{ message = "^chore\\(release\\)", skip = true },
22+
]

0 commit comments

Comments
 (0)