Skip to content

Commit 9a43dac

Browse files
committed
Use towncrier to generate changelogs
1 parent e6f7b42 commit 9a43dac

29 files changed

Lines changed: 1204 additions & 1159 deletions

.github/workflows/changelog.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Changelog
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, labeled, unlabeled, reopened]
6+
branches-ignore:
7+
- master
8+
9+
env:
10+
DEFAULT_PYTHON: '3.13'
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
check-changelog:
17+
name: Changelog Entry Check
18+
runs-on: ubuntu-latest
19+
if: "!contains(github.event.pull_request.labels.*.name, 'ci:skip-changelog') && github.event.pull_request.user.login != 'pre-commit-ci[bot]' && github.event.pull_request.user.login != 'dependabot[bot]'"
20+
21+
permissions:
22+
contents: read
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v6
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
31+
id: python
32+
uses: actions/setup-python@v6
33+
with:
34+
python-version: ${{ env.DEFAULT_PYTHON }}
35+
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v7
38+
with:
39+
activate-environment: "true"
40+
enable-cache: "false"
41+
42+
- name: Install dependencies
43+
run: |
44+
uv sync --only-group docs
45+
46+
- name: Check changelog entry exists
47+
run: |
48+
if [ ! -s docs/changelog/next_release/${{ github.event.pull_request.number }}.*.rst ]; then
49+
echo "Please add corresponding file 'docs/changelog/next_release/<issue number>.<change type>.rst' with changes description"
50+
exit 1
51+
fi
52+
53+
- name: Validate changelog
54+
run: |
55+
# Fetch the pull request' base branch so towncrier will be able to
56+
# compare the current branch with the base branch.
57+
git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
58+
towncrier check --compare-with origin/${{ github.base_ref }}
59+
towncrier --draft

.github/workflows/release.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ jobs:
4444
version=$(echo $GITHUB_REF_SLUG | sed -E "s/v(.*)/\1/")
4545
sed -i -E "s/dynamic = .*/version = \"${version}\"/" pyproject.toml
4646
47-
- name: Build release notes
48-
run: |
49-
mkdir reports/
50-
uv pip install -e .
51-
# lines 1 and 3 are empty, line 2 contains version number, line 4 contains release date
52-
changelog generate-md -c ./docs/conf.py CHANGELOG.rst -v $version | sed "1,4d" > reports/release.md
53-
sed -i -E 's/:github-user:`(.*)`/@\1/g' reports/release.md
54-
sed -i -E 's/:issue:`(.*)`/#\1/g' reports/release.md
55-
sed -i -E 's/:pr:`(.*)`/#\1/g' reports/release.md
56-
5747
- name: Publish package
5848
uses: pypa/gh-action-pypi-publish@release/v1
5949

0 commit comments

Comments
 (0)