Skip to content

Commit 4b0e153

Browse files
committed
fixes
1 parent 61e95a7 commit 4b0e153

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

.github/workflows/rust-release.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,19 @@ jobs:
205205
env:
206206
NEW_VERSION: ${{ steps.next_version.outputs.new_version }}
207207
run: |
208-
# Update workspace version
209-
sed -i.bak "s/^version = \".*\"/version = \"$NEW_VERSION\"/" Cargo.toml
210-
rm Cargo.toml.bak
208+
# Update only the workspace version (first occurrence under [workspace.package])
209+
# Use awk to only replace the version in the [workspace.package] section
210+
awk -v new_ver="$NEW_VERSION" '
211+
/^\[workspace\.package\]/ { in_workspace=1 }
212+
/^\[/ && !/^\[workspace\.package\]/ { in_workspace=0 }
213+
in_workspace && /^version = / && !replaced {
214+
print "version = \"" new_ver "\""
215+
replaced=1
216+
next
217+
}
218+
{ print }
219+
' Cargo.toml > Cargo.toml.tmp
220+
mv Cargo.toml.tmp Cargo.toml
211221
212222
echo "Updated Cargo.toml to version $NEW_VERSION"
213223
git diff Cargo.toml

0 commit comments

Comments
 (0)