Skip to content

Commit 0554168

Browse files
committed
chore: use bumpver to manage versions
1 parent 5076be0 commit 0554168

File tree

4 files changed

+48
-26
lines changed

4 files changed

+48
-26
lines changed

pyproject.toml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,28 @@ build-backend = "setuptools.build_meta"
5656
[tool.setuptools.dynamic]
5757
version = { attr = "pytest_codspeed.__version__" }
5858

59-
[tool.hatch.envs.default]
60-
python = "3.11"
61-
features = ["lint", "test", "compat"]
6259

63-
[tool.hatch.envs.test]
64-
features = ["test"]
60+
[tool.bumpver]
61+
current_version = "3.0.0"
62+
version_pattern = "MAJOR.MINOR.PATCH[-TAG]"
63+
commit_message = "Release v{new_version} 🚀"
64+
tag_message = "Release v{new_version} 🚀"
65+
tag_scope = "default"
66+
allow_dirty = false
67+
pre_commit_hook = "./scripts/pre-release.sh"
68+
post_commit_hook = "./scripts/post-release.sh"
69+
commit = true
70+
tag = false
71+
push = false
72+
73+
74+
[tool.bumpver.file_patterns]
75+
"pyproject.toml" = ['current_version = "{version}"']
76+
"src/pytest_codspeed/__init__.py" = [
77+
'__version__ = "{pep440_version}"',
78+
'__semver_version__ = "{version}"',
79+
]
6580

66-
[[tool.hatch.envs.test.matrix]]
67-
python = ["3.9", "3.10", "3.11", "3.12", "3.13"]
68-
features = ["compat", "test"]
6981

7082
[tool.mypy]
7183
python_version = "3.12"

scripts/post-release.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -e
3+
4+
VERSION=v$BUMPVER_NEW_VERSION
5+
6+
git tag v$VERSION -m "Release v$VERSION 🚀"
7+
git push --follow-tags

scripts/pre-release.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -e
3+
4+
VERSION=v$BUMPVER_NEW_VERSION
5+
6+
# Skip alpha/beta/rc changelog generation
7+
if [[ $VERSION == *"alpha"* ]] || [[ $VERSION == *"beta"* ]] || [[ $VERSION == *"rc"* ]]; then
8+
echo "Skipping changelog generation for alpha/beta/rc release"
9+
else
10+
echo "Generating changelog for $VERSION"
11+
# Check that GITHUB_TOKEN is set
12+
if [ -z "$GITHUB_TOKEN" ]; then
13+
echo "GITHUB_TOKEN is not set. Trying to fetch it from gh"
14+
GITHUB_TOKEN=$(gh auth token)
15+
fi
16+
git cliff -o CHANGELOG.md --tag $VERSION
17+
git add CHANGELOG.md
18+
fi
19+
20+
uv sync
21+
git add uv.lock

scripts/release.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)