Ensure current crate versions match the tag before publishing to crates.io

This commit is contained in:
Michael Vines 2019-03-20 20:30:44 -07:00
parent 799085a105
commit b03d9884a3
1 changed files with 9 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
source ci/semver_bash/semver.sh
# List of internal crates to publish # List of internal crates to publish
# #
@ -38,6 +38,9 @@ CRATES=(
exit 0 exit 0
} }
semverParseInto "$TRIGGERED_BUILDKITE_TAG" MAJOR MINOR PATCH SPECIAL
expectedCrateVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"
[[ -n "$CRATES_IO_TOKEN" ]] || { [[ -n "$CRATES_IO_TOKEN" ]] || {
echo CRATES_IO_TOKEN undefined echo CRATES_IO_TOKEN undefined
exit 1 exit 1
@ -51,8 +54,11 @@ for crate in "${CRATES[@]}"; do
exit 1 exit 1
fi fi
echo "-- $crate" echo "-- $crate"
# TODO: Ensure the published version matches the contents of grep -q "^version = \"$expectedCrateVersion\"$" Cargo.toml || {
# TRIGGERED_BUILDKITE_TAG echo "Error: $crate/Cargo.toml version is not $expectedCrateVersion"
exit 1
}
( (
set -x set -x
# TODO: the rocksdb package does not build with the stock rust docker image, # TODO: the rocksdb package does not build with the stock rust docker image,