2018-11-11 08:19:04 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2018-05-21 23:02:54 -07:00
|
|
|
|
2018-05-27 18:19:07 -07:00
|
|
|
cd "$(dirname "$0")/.."
|
2018-05-21 23:02:54 -07:00
|
|
|
|
2018-10-25 16:37:54 -07:00
|
|
|
if [[ -z "$BUILDKITE_TAG" && -z "$TRIGGERED_BUILDKITE_TAG" ]]; then
|
2018-05-21 23:02:54 -07:00
|
|
|
# Skip publish if this is not a tagged release
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2018-05-25 15:08:14 -07:00
|
|
|
if [[ -z "$CRATES_IO_TOKEN" ]]; then
|
2018-05-21 23:02:54 -07:00
|
|
|
echo CRATES_IO_TOKEN undefined
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-10-25 12:26:57 -07:00
|
|
|
maybePublish="echo Publish skipped"
|
|
|
|
if [[ -n $CI ]]; then
|
|
|
|
maybePublish="cargo publish --token $CRATES_IO_TOKEN"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# shellcheck disable=2044 # Disable 'For loops over find output are fragile...'
|
2018-12-05 11:41:21 -08:00
|
|
|
for Cargo_toml in {sdk,metrics,drone,programs/native/{budget,bpf_loader,lua_loader,native_loader,noop,system,vote},.}/Cargo.toml; do
|
2018-10-25 12:26:57 -07:00
|
|
|
# TODO: Ensure the published version matches the contents of BUILDKITE_TAG
|
|
|
|
(
|
|
|
|
set -x
|
|
|
|
ci/docker-run.sh rust bash -exc "cd $(dirname "$Cargo_toml"); cargo package; $maybePublish"
|
|
|
|
)
|
|
|
|
done
|
2018-05-21 23:02:54 -07:00
|
|
|
|
|
|
|
exit 0
|