Skip to content

Commit 8cb85e8

Browse files
authored
feat: Add Rust support to bump-version workflow (#7342)
Adding rust support to the bump version workflow
1 parent b375a32 commit 8cb85e8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/bump-version.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,22 @@ jobs:
4444
re="$(sed 's/[_-]/[_-]/g' <<< "$PACKAGE")"
4545
sed -i "s/^\($re\)==.*/\1==$VERSION/g" -- requirements*.txt
4646
47-
sed -i "s/^\($re\) = \".*\"/\1 = \"$VERSION\"/g" -- rust_snuba/Cargo.toml
47+
# Update Cargo.toml dependencies (format: package = "version")
48+
sed -i "s/^\($re\) = \"[^\"]*\"/\1 = \"$VERSION\"/g" -- rust_snuba/Cargo.toml
49+
# Also handle dependencies with features (format: package = { version = "version", features = [...] })
50+
sed -i "s/^\($re\) = { version = \"[^\"]*\"/\1 = { version = \"$VERSION\"/g" -- rust_snuba/Cargo.toml
51+
52+
# Update Cargo.lock if Cargo.toml was modified
53+
if ! git diff --exit-code -- rust_snuba/Cargo.toml > /dev/null 2>&1; then
54+
cd rust_snuba
55+
# Try updating with underscores (cargo prefers underscores in package names)
56+
CARGO_PACKAGE="$(echo "$PACKAGE" | sed 's/-/_/g')"
57+
if ! cargo update --package "$CARGO_PACKAGE" 2>/dev/null; then
58+
# If that fails, try with the original package name
59+
cargo update --package "$PACKAGE"
60+
fi
61+
cd ..
62+
fi
4863
4964
if git diff --exit-code; then
5065
exit 0

0 commit comments

Comments
 (0)