diff --git a/.github/tag-release.sh b/.github/tag-release.sh new file mode 100755 index 0000000..0608df5 --- /dev/null +++ b/.github/tag-release.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +export VERSION="${1:-}" + +echo "$VERSION" | grep -qEo '[0-9]+\.[0-9]+\.[0-9]+' +if [ $? -ne 0 ]; then + echo "Invalid version number. Please use the format '0.2.0'" + exit 1 +fi + +# Bump version in pyproject.toml and sync the uv.lock file +sed -i 's/^\(version = \).*$/\1'\"$VERSION\"'/' pyproject.toml +uv sync + +git add pyproject.toml uv.lock +git commit -m "chore: bump version to $VERSION" +git tag -a "$VERSION" -m "$VERSION" + +git push origin main "$VERSION" diff --git a/README.md b/README.md index 529a3be..d9c8519 100644 --- a/README.md +++ b/README.md @@ -119,3 +119,12 @@ ruff check --fix # Format the code ruff format ``` + +## Releasing + +Once all the changes have been merged into `main` for a release, use the +[`.github/tag-release`](./.github/tag-release.sh) script to create a version bump commit in the +right format, create, **and push** the tag ready for release. + +This could be automated with Github Actions - but commit signing gets a little complicated, so for +now it's just a script that can be run by maintainers.