Skip to content

Commit 8ef29d8

Browse files
authored
Add just recipe to bump version (#116)
1 parent 5745db9 commit 8ef29d8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

justfile

+22
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,25 @@ build:
4848
fi
4949

5050
uv build
51+
52+
# Bump our version
53+
bump-version $VERSION: (_validate_semver VERSION)
54+
#!/usr/bin/env bash
55+
set -euxo pipefail
56+
57+
test -z "$(git status --porcelain)" || (echo "The working directory is not clean"; exit 1)
58+
59+
sed -i 's/^version = .*/version = "'$VERSION'"/g' pyproject.toml
60+
uv lock --offline
61+
62+
git add pyproject.toml *.lock
63+
git commit -m "Bump version to v{{ VERSION }}"
64+
65+
# Validate a version against SemVer
66+
_validate_semver version:
67+
#!/usr/bin/env bash
68+
set -euxo pipefail
69+
if [[ ! "{{ version }}" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
70+
echo Invalid SemVer {{ version }}
71+
exit 1
72+
fi

0 commit comments

Comments
 (0)