Skip to content

Commit 3a288b5

Browse files
committed
Integrate towncrier into the development process
1 parent c776508 commit 3a288b5

File tree

8 files changed

+127
-8
lines changed

8 files changed

+127
-8
lines changed
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
name: Lint & test
1+
name: CI
22

33
on:
44
push:
55
branches:
6-
- 'main'
76
- 'master'
8-
paths-ignore:
9-
- 'docs/**'
10-
- 'README.md'
117
pull_request:
128
workflow_dispatch:
139
workflow_call:
@@ -18,12 +14,18 @@ jobs:
1814
steps:
1915
- name: Checkout
2016
uses: actions/checkout@v6
17+
with:
18+
fetch-depth: 0
2119
- name: Install uv and set the Python version
2220
uses: astral-sh/setup-uv@v7
2321
with:
2422
python-version: '3.10'
2523
- name: Run pre-commit hooks
2624
run: uv tool run --with pre-commit-uv pre-commit run --all-files --show-diff-on-failure --color=always
25+
- name: Install towncrier
26+
run: uv sync --only-group release
27+
- name: Run towncrier check
28+
run: uv run towncrier check --compare-with origin/${{github.event.pull_request.base.ref}}
2729
test:
2830
runs-on: ubuntu-latest
2931
strategy:

.github/workflows/release.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ on:
44
tags:
55
- "v*.*.*"
66
jobs:
7-
test:
8-
uses: ./.github/workflows/test.yml
97
pypi:
10-
needs: test
118
runs-on: ubuntu-latest
129
environment:
1310
name: pypi

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ repos:
2222
rev: 'v1.19.1'
2323
hooks:
2424
- id: mypy
25+
- repo: https://github.com/twisted/towncrier
26+
rev: 23.11.0
27+
hooks:
28+
- id: towncrier-check
29+
args: ['--dir', 'changelog.d', '--compare-with', 'origin/master']

bin/make_release

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
version="$1"
6+
7+
if [ -z "$version" ]; then
8+
echo "Usage: $0 <version>"
9+
exit 1
10+
fi
11+
12+
if ! [[ "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
13+
echo "Version must be in v0.0.0 format"
14+
exit 1
15+
fi
16+
17+
if [ -n "$(git status --porcelain)" ]; then
18+
echo "Commit existing changes before proceeding with the release"
19+
exit 1
20+
fi
21+
22+
if ! towncrier check; then
23+
echo "Nothing to release"
24+
exit 1
25+
fi
26+
27+
towncrier build --version "$version" --yes
28+
29+
commit_msg="release $version"
30+
31+
git add -A
32+
git commit -m "$commit_msg"
33+
echo "Created commit $commit_msg"
34+
echo "Next steps:"
35+
echo ""
36+
echo " $ git push origin master"
37+
38+
echo "Wait for CI to pass and then:"
39+
echo ""
40+
41+
echo " $ git tag $version"
42+
echo " $ git push origin $version"

changelog.d/+towncrier.misc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Integrate [towncrier](https://towncrier.readthedocs.io/en/stable/index.html) into the development process

changelog.d/.gitkeep

Whitespace-only changes.

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ test = [
4444
"freezegun",
4545
"coverage[toml]",
4646
]
47+
release = [
48+
"towncrier",
49+
]
4750

4851
[tool.hatch.version]
4952
source = "vcs"
@@ -64,3 +67,9 @@ lint.extend-select = ["I"]
6467
python_version = "3.9"
6568
ignore_missing_imports = true
6669
exclude = ".venv"
70+
71+
[tool.towncrier]
72+
directory = "changelog.d"
73+
filename = "CHANGELOG.md"
74+
title_format = "## [{version}](https://github.com/olzhasar/pytest-watcher/releases/tag/{version}) - {project_date}"
75+
issue_format = "[#{issue}](https://github.com/olzhasar/pytest-watcher/issues/{issue})"

uv.lock

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)