Debian Codegraph @

scripts/release.sh

raw
1 #!/bin/bash
2
3 # Validate version bump type
4 BUMP_TYPE=$1
5 if [ -z "$BUMP_TYPE" ] || { [ "$BUMP_TYPE" != "fix" ] && [ "$BUMP_TYPE" != "minor" ] && [ "$BUMP_TYPE" != "major" ]; }; then
6 echo "Error: Version bump type is required and must be one of: fix, minor, major"
7 echo "Usage: $0 <fix|minor|major>"
8 exit 1
9 fi
10
11 uvx hatch version $BUMP_TYPE
12
13 VERSION=$(uvx hatch version)
14
15 uvx git-cliff -o CHANGELOG.md --tag v$VERSION
16 git add CHANGELOG.md src/*/__init__.py
17 git commit -m "Bump to v$VERSION"
18 git tag -a "v$VERSION" -m "Release v$VERSION"
19 git push origin "v$VERSION"
20
21 rm -rf dist
22 uv build
23 uv publish
24
25 # If `uv publish` is broken:
26 # uvx hatch build && uvx hatch publish