Skip to content

Commit

Permalink
Add just recipe to bump version (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
SRv6d authored Sep 15, 2024
1 parent 5745db9 commit 8ef29d8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,25 @@ build:
fi

uv build

# Bump our version
bump-version $VERSION: (_validate_semver VERSION)
#!/usr/bin/env bash
set -euxo pipefail

test -z "$(git status --porcelain)" || (echo "The working directory is not clean"; exit 1)

sed -i 's/^version = .*/version = "'$VERSION'"/g' pyproject.toml
uv lock --offline

git add pyproject.toml *.lock
git commit -m "Bump version to v{{ VERSION }}"

# Validate a version against SemVer
_validate_semver version:
#!/usr/bin/env bash
set -euxo pipefail
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
echo Invalid SemVer {{ version }}
exit 1
fi

0 comments on commit 8ef29d8

Please sign in to comment.