Skip to content

Commit 41659b6

Browse files
Fix the template bump script to accept leading 'v' (#3331)
Signed-off-by: Brian Hardock <[email protected]>
1 parent c3ebcf8 commit 41659b6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

scripts/bump-rust-template-sdk.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trap 'find templates -name "*.bak" -delete' EXIT
1414
usage() {
1515
echo "Usage: $0 <VERSION>"
1616
echo "Updates the Rust templates SDK dependency to the specified version"
17-
echo "Example: $0 6.0.0"
17+
echo "Example: $0 v6.0.0"
1818
}
1919

2020
if [[ $# -ne 1 ]]
@@ -24,12 +24,14 @@ then
2424
fi
2525

2626
# Ensure version is an 'official' release
27-
if [[ ! "${VERSION}" =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]
27+
if [[ ! "${VERSION}" =~ ^v[0-9]+.[0-9]+.[0-9]+$ ]]
2828
then
29-
echo "VERSION doesn't match [0-9]+.[0-9]+.[0-9]+ and may be a prerelease; skipping."
29+
echo "VERSION doesn't match v[0-9]+.[0-9]+.[0-9]+ and may be a prerelease; skipping."
3030
exit 1
3131
fi
3232

33+
# Strip the leading v for Cargo.toml
34+
STRIPPED_VERSION="${VERSION#v}"
3335

3436
# Update the version in the Cargo.toml.tmpl files for each Rust template
35-
find templates -type f -path "templates/*-rust/content/Cargo.toml.tmpl" -exec $SED_INPLACE "/^\[dependencies\]/,/^\[/ s/^spin-sdk = \".*\"/spin-sdk = \"${VERSION}\"/" {} +
37+
find templates -type f -path "templates/*-rust/content/Cargo.toml.tmpl" -exec $SED_INPLACE "/^\[dependencies\]/,/^\[/ s/^spin-sdk = \".*\"/spin-sdk = \"${STRIPPED_VERSION}\"/" {} +

0 commit comments

Comments
 (0)