Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,5 @@ bump-version: ## Bump version across all files (usage: make bump-version VERSION
@echo ""
@echo "Verify with: make show-version"

check-versions: ## Check workspace crate versions against latest tag (usage: make check-versions [TAG=v1.0.0])
@if [ -n "$(TAG)" ]; then \
./scripts/check_release_versions.sh "$(TAG)"; \
else \
./scripts/check_release_versions.sh; \
fi
check-versions: ## Check workspace crate versions against latest tag (usage: make check-versions [TAG=v1.0.0] [VERSION_OVERRIDE=1.3.1])
@VERSION_OVERRIDE="$(VERSION_OVERRIDE)" ./scripts/check_release_versions.sh $(TAG)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Quote TAG when invoking version-check script

The new check-versions recipe passes $(TAG) to the shell unquoted, so any shell metacharacters in the value are interpreted by /bin/sh instead of being treated as a single tag argument. This is a regression from the previous implementation, which quoted "$(TAG)"; for example, make check-versions TAG='release; echo injected' runs an extra command and does not validate the intended tag.

Useful? React with 👍 / 👎.

20 changes: 19 additions & 1 deletion scripts/check_release_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,20 @@ if ! git rev-parse "$TAG" >/dev/null 2>&1; then
exit 1
fi

# ---------------------------------------------------------------------------
# VERSION_OVERRIDE: skip conventional-commit detection and use this version
# for all bumps. Set via: VERSION_OVERRIDE=1.3.1 ./check_release_versions.sh
# ---------------------------------------------------------------------------
VERSION_OVERRIDE="${VERSION_OVERRIDE:-}"
if [[ -n "$VERSION_OVERRIDE" && ! "$VERSION_OVERRIDE" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo -e "${RED}ERROR: VERSION_OVERRIDE must be in X.Y.Z format, got: '$VERSION_OVERRIDE'${NC}" >&2
exit 1
fi

echo -e "${BOLD}Checking workspace versions against tag: ${BLUE}$TAG${NC}"
if [[ -n "$VERSION_OVERRIDE" ]]; then
Comment thread
slin1237 marked this conversation as resolved.
echo -e "${BOLD}Version override: ${CYAN}$VERSION_OVERRIDE${NC} (ignoring conventional commit detection)"
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
echo ""

# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -217,10 +230,15 @@ detect_bump_level() {
echo "$level"
}

# Bump version by level: major, minor, or patch
# Bump version by level: major, minor, or patch.
# If VERSION_OVERRIDE is set, always returns the override (ignoring level).
bump_version() {
local version="$1"
local level="$2"
if [[ -n "$VERSION_OVERRIDE" ]]; then
echo "$VERSION_OVERRIDE"
return
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "ERROR: bump_version only supports X.Y.Z format, got: $version" >&2
return 1
Expand Down
Loading