script/release
#!/usr/bin/env bashset -e REPO_PATH="$( dirname "$( cd "$(dirname "$0")" ; pwd -P )" )" if [ "$(git rev-parse --abbrev-ref HEAD)" != "dev" ]; then echo "Refusing to publish a release from a branch other than dev" exit 1fi function generate_version { latest_tag="$(git tag --sort=committerdate | tail -1)" month="$(date +'%Y.%m')" if [[ "$latest_tag" =~ "$month".* ]]; then patch="$(echo "$latest_tag" | cut -d . -f 3)" ((patch=patch+1)) echo "$month.$patch" else echo "$month.0" fi} # Temporarily uninstall pre-commit hooks so that we can push to dev and main:pre-commit uninstall # Pull the latest dev:git pull origin dev # Generate the next version (in the format YEAR.MONTH.RELEASE_NUMER):new_version=$(generate_version) # Update the PyPI package version:sed -i "" "s/^version = \".*\"/version = \"$new_version\"/g" "$REPO_PATH/pyproject.toml"git add pyproject.toml # Update the uv lockfile:uv lockgit add uv.lock # Commit, tag, and push:git commit -m "Bump version to $new_version"git tag "$new_version"git push && git push --tags # Merge dev into main:git checkout maingit merge devgit pushgit checkout dev # Re-initialize pre-commit:pre-commit install