Skip to content

Commit dd2ee59

Browse files
AlexMikhalevclaude
andauthored
fix(ci): scope publish script version sed to package section only (#574)
The update_versions function replaced ALL lines matching ^version = "..." which corrupted dependency versions in multi-line [dependencies.X] blocks. For example, notify's version "6.1" in terraphim_router was changed to "1.10.0", causing cargo publish to fail with "failed to select a version". Fix: use sed range addressing (0,/pattern/ on GNU, 1,/pattern/ on BSD) to only replace the first occurrence -- the [package] version line. Co-authored-by: Terraphim AI <noreply@anthropic.com>
1 parent c3190dd commit dd2ee59

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

scripts/publish-crates.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,13 @@ update_versions() {
193193
if [[ -f "$crate_path" ]]; then
194194
log_info "Updating $crate to version $VERSION"
195195

196-
# Update version in Cargo.toml
196+
# Update ONLY the [package] version in Cargo.toml (first occurrence).
197+
# Using 0,/pattern/ (GNU sed) or 1,/pattern/ (BSD sed) to avoid
198+
# corrupting dependency version lines in [dependencies.X] sections.
197199
if [[ "$OSTYPE" == "darwin"* ]]; then
198-
sed -i '' "s/^version = \".*\"/version = \"$VERSION\"/" "$crate_path"
200+
sed -i '' '1,/^version = ".*"/s/^version = ".*"/version = "'"$VERSION"'"/' "$crate_path"
199201
else
200-
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" "$crate_path"
202+
sed -i '0,/^version = ".*"/s/^version = ".*"/version = "'"$VERSION"'"/' "$crate_path"
201203
fi
202204

203205
# Update workspace dependencies

0 commit comments

Comments
 (0)