2018-11-11 08:19:04 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2018-05-27 18:19:07 -07:00
|
|
|
cd "$(dirname "$0")/.."
|
2019-03-20 20:30:44 -07:00
|
|
|
source ci/semver_bash/semver.sh
|
2018-05-21 23:02:54 -07:00
|
|
|
|
2018-12-11 22:38:55 -08:00
|
|
|
# Only package/publish if this is a tagged release
|
2019-01-09 09:28:19 -08:00
|
|
|
[[ -n $TRIGGERED_BUILDKITE_TAG ]] || {
|
|
|
|
echo TRIGGERED_BUILDKITE_TAG unset, skipped
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2019-03-20 20:30:44 -07:00
|
|
|
semverParseInto "$TRIGGERED_BUILDKITE_TAG" MAJOR MINOR PATCH SPECIAL
|
|
|
|
expectedCrateVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"
|
|
|
|
|
2019-01-09 09:28:19 -08:00
|
|
|
[[ -n "$CRATES_IO_TOKEN" ]] || {
|
|
|
|
echo CRATES_IO_TOKEN undefined
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
cargoCommand="cargo publish --token $CRATES_IO_TOKEN"
|
2018-10-25 12:26:57 -07:00
|
|
|
|
2019-05-30 11:53:41 -07:00
|
|
|
Cargo_tomls=$(ci/order-crates-for-publishing.py)
|
|
|
|
|
2019-05-30 13:44:27 -07:00
|
|
|
for Cargo_toml in $Cargo_tomls; do
|
2019-05-30 11:53:41 -07:00
|
|
|
echo "-- $Cargo_toml"
|
|
|
|
grep -q "^version = \"$expectedCrateVersion\"$" "$Cargo_toml" || {
|
|
|
|
echo "Error: $Cargo_toml version is not $expectedCrateVersion"
|
2019-03-20 20:30:44 -07:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2018-10-25 12:26:57 -07:00
|
|
|
(
|
|
|
|
set -x
|
2019-05-30 11:53:41 -07:00
|
|
|
crate=$(dirname "$Cargo_toml")
|
2019-01-07 21:46:55 -08:00
|
|
|
# TODO: the rocksdb package does not build with the stock rust docker image,
|
|
|
|
# so use the solana rust docker image until this is resolved upstream
|
2019-03-14 19:41:05 -07:00
|
|
|
source ci/rust-version.sh
|
|
|
|
ci/docker-run.sh "$rust_stable_docker_image" bash -exc "cd $crate; $cargoCommand"
|
2019-01-07 21:46:55 -08:00
|
|
|
#ci/docker-run.sh rust bash -exc "cd $crate; $cargoCommand"
|
2019-05-30 11:53:41 -07:00
|
|
|
) || true # <-- Don't fail. We want to be able to retry the job in cases when a publish fails halfway due to network/cloud issues
|
2018-10-25 12:26:57 -07:00
|
|
|
done
|
2018-05-21 23:02:54 -07:00
|
|
|
|
|
|
|
exit 0
|