ci: fix publish crate version checking (#31894)
* ci: fix publish crate version checking * ci: add warning when publish crates don't use worksapce version
This commit is contained in:
parent
1d6b03358f
commit
405db3e436
|
@ -26,14 +26,28 @@ expectedCrateVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check workspace.version for worksapce root
|
||||||
|
workspace_cargo_tomls=(Cargo.toml programs/sbf/Cargo.toml)
|
||||||
|
for cargo_toml in "${workspace_cargo_tomls[@]}"; do
|
||||||
|
if ! grep -q "^version = \"$expectedCrateVersion\"$" "$cargo_toml"; then
|
||||||
|
echo "Error: Cargo.toml version is not $expectedCrateVersion"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
Cargo_tomls=$(ci/order-crates-for-publishing.py)
|
Cargo_tomls=$(ci/order-crates-for-publishing.py)
|
||||||
|
|
||||||
for Cargo_toml in $Cargo_tomls; do
|
for Cargo_toml in $Cargo_tomls; do
|
||||||
echo "--- $Cargo_toml"
|
echo "--- $Cargo_toml"
|
||||||
grep -q "^version = \"$expectedCrateVersion\"$" "$Cargo_toml" || {
|
|
||||||
echo "Error: $Cargo_toml version is not $expectedCrateVersion"
|
# check the version which doesn't inherit from worksapce
|
||||||
exit 1
|
if ! grep -q "^version = { workspace = true }$" "$Cargo_toml"; then
|
||||||
}
|
echo "Warn: $Cargo_toml doesn't use the inherited version"
|
||||||
|
grep -q "^version = \"$expectedCrateVersion\"$" "$Cargo_toml" || {
|
||||||
|
echo "Error: $Cargo_toml version is not $expectedCrateVersion"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
crate_name=$(grep -m 1 '^name = ' "$Cargo_toml" | cut -f 3 -d ' ' | tr -d \")
|
crate_name=$(grep -m 1 '^name = ' "$Cargo_toml" | cut -f 3 -d ' ' | tr -d \")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue