Files
python-repositories/scripts/ci/bump-version.sh
T
Brian Bjarke JensenandCursor ac487d91f8
Code Quality Pipeline / code-quality (pull_request) Failing after 49s
PR Title Check / check-title (pull_request) Successful in 6s
Test Python Package / test (pull_request) Successful in 1m9s
Sync uv.lock on release to keep CI clean.
Run uv lock during version bumps and commit the lockfile in the release workflow.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-05 20:06:35 +02:00

45 lines
879 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=common.sh
source "${SCRIPT_DIR}/common.sh"
usage() {
echo "Usage: bump-version.sh <major|minor|patch>" >&2
echo " bump-version.sh --from-tag <vX.Y.Z>" >&2
exit 1
}
if [[ $# -lt 1 ]]; then
usage
fi
if [[ "$1" == "--from-tag" ]]; then
if [[ $# -ne 2 ]]; then
usage
fi
VERSION="${2#v}"
else
BUMP_TYPE="$1"
CURRENT=$(latest_tag_version)
VERSION=$(bump_semver "$CURRENT" "$BUMP_TYPE")
fi
set_pyproject_version "$VERSION"
if command -v uv >/dev/null 2>&1; then
uv lock
else
echo "uv not found; uv.lock was not updated" >&2
exit 1
fi
if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
else
echo "version=${VERSION}"
fi
echo "Updated pyproject.toml and uv.lock to version ${VERSION}" >&2