Skip to content

Commit

Permalink
chore: use bumpver to manage versions
Browse files Browse the repository at this point in the history
  • Loading branch information
art049 committed Dec 5, 2024
1 parent 5076be0 commit fab73b4
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 26 deletions.
28 changes: 20 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,28 @@ build-backend = "setuptools.build_meta"
[tool.setuptools.dynamic]
version = { attr = "pytest_codspeed.__version__" }

[tool.hatch.envs.default]
python = "3.11"
features = ["lint", "test", "compat"]

[tool.hatch.envs.test]
features = ["test"]
[tool.bumpver]
current_version = "3.0.0"
version_pattern = "MAJOR.MINOR.PATCH[-TAG]"
commit_message = "Release v{new_version} 🚀"
tag_message = "Release v{new_version} 🚀"
tag_scope = "default"
allow_dirty = false
pre_commit_hook = "./scripts/pre-release.sh"
post_commit_hook = "./scripts/post-release.sh"
commit = true
tag = false
push = false


[tool.bumpver.file_patterns]
"pyproject.toml" = ['current_version = "{version}"']
"src/pytest_codspeed/__init__.py" = [
'__version__ = "{pep440_version}"',
'__semver_version__ = "{version}"',
]

[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.10", "3.11", "3.12", "3.13"]
features = ["compat", "test"]

[tool.mypy]
python_version = "3.12"
Expand Down
7 changes: 7 additions & 0 deletions scripts/post-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e

VERSION=v$BUMPVER_NEW_VERSION

git tag v$VERSION -m "Release v$VERSION 🚀"
git push --follow-tags
21 changes: 21 additions & 0 deletions scripts/pre-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -e

VERSION=v$BUMPVER_NEW_VERSION

# Skip alpha/beta/rc changelog generation
if [[ $VERSION == *"alpha"* ]] || [[ $VERSION == *"beta"* ]] || [[ $VERSION == *"rc"* ]]; then
echo "Skipping changelog generation for alpha/beta/rc release"
else
echo "Generating changelog for $VERSION"
# Check that GITHUB_TOKEN is set
if [ -z "$GITHUB_TOKEN" ]; then
echo "GITHUB_TOKEN is not set. Trying to fetch it from gh"
GITHUB_TOKEN=$(gh auth token)
fi
git cliff -o CHANGELOG.md --tag $VERSION
git add CHANGELOG.md
fi

uv sync
git add uv.lock
18 changes: 0 additions & 18 deletions scripts/release.sh

This file was deleted.

0 comments on commit fab73b4

Please # to comment.