Skip to content

Commit 7ba547b

Browse files
fix: strip trailing comments when extracting Cargo.toml version (#26)
* fix: strip trailing comments when extracting Cargo.toml version The sed pattern in check/tag-version only matched up to the closing quote but didn't consume the rest of the line, so the release-please comment suffix (# x-release-please-version) leaked into the extracted version string, failing the tag comparison. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use cargo metadata + jq to extract version from Cargo.toml Replaces fragile sed parsing with structured JSON output from cargo, avoiding issues with inline comments like the release-please version annotation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 91a81f8 commit 7ba547b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ mac/arm64:
5555
.PHONY: check/tag-version
5656
check/tag-version:
5757
@TAG_VERSION=$${TAG#python-}; \
58-
CARGO_VERSION=$$(sed -n 's/^version = "\(.*\)"/\1/p' rust/Cargo.toml); \
58+
CARGO_VERSION=$$(cd rust && cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version'); \
5959
if [ "$$TAG_VERSION" != "$$CARGO_VERSION" ]; then \
6060
echo "error: tag version ($$TAG_VERSION) does not match Cargo.toml version ($$CARGO_VERSION)"; \
6161
exit 1; \

0 commit comments

Comments
 (0)