solana/ci/snap.sh

71 lines
1.5 KiB
Bash
Raw Normal View History

2018-06-18 13:45:53 -07:00
#!/bin/bash -e
cd "$(dirname "$0")/.."
2018-10-24 19:36:50 -07:00
if ! ci/version-check.sh stable; then
# This job doesn't run within a container, try once to upgrade tooling on a
# version check failure
rustup install stable
ci/version-check.sh stable
fi
2018-06-18 13:45:53 -07:00
DRYRUN=
if [[ -z $BUILDKITE_BRANCH ]] || ./ci/is-pr.sh; then
2018-06-18 13:45:53 -07:00
DRYRUN="echo"
fi
eval "$(ci/channel-info.sh)"
if [[ $BUILDKITE_BRANCH = "$STABLE_CHANNEL" ]]; then
2018-10-02 15:30:07 -07:00
CHANNEL=stable
elif [[ $BUILDKITE_BRANCH = "$EDGE_CHANNEL" ]]; then
2018-10-02 15:30:07 -07:00
CHANNEL=edge
elif [[ $BUILDKITE_BRANCH = "$BETA_CHANNEL" ]]; then
2018-10-02 15:30:07 -07:00
CHANNEL=beta
2018-06-18 13:45:53 -07:00
fi
2018-10-02 15:30:07 -07:00
if [[ -z $CHANNEL ]]; then
echo Unable to determine channel to publish into, exiting.
exit 0
fi
2018-06-24 21:24:08 -07:00
if [[ -z $DRYRUN ]]; then
[[ -n $SNAPCRAFT_CREDENTIALS_KEY ]] || {
echo SNAPCRAFT_CREDENTIALS_KEY not defined
exit 1;
}
2018-06-18 13:45:53 -07:00
(
openssl aes-256-cbc -d \
-in ci/snapcraft.credentials.enc \
-out ci/snapcraft.credentials \
-k "$SNAPCRAFT_CREDENTIALS_KEY"
snapcraft login --with ci/snapcraft.credentials
) || {
rm -f ci/snapcraft.credentials;
exit 1
}
fi
set -x
2018-06-24 21:24:08 -07:00
echo --- checking for multilog
if [[ ! -x /usr/bin/multilog ]]; then
2018-09-07 12:24:23 -07:00
if [[ -z $CI ]]; then
echo "multilog not found, install with: sudo apt-get install -y daemontools"
exit 1
fi
sudo apt-get install -y daemontools
fi
2018-10-02 15:30:07 -07:00
echo --- build: $CHANNEL channel
2018-06-18 13:45:53 -07:00
snapcraft
2018-06-24 21:24:08 -07:00
2018-06-24 10:10:55 -07:00
source ci/upload_ci_artifact.sh
upload_ci_artifact solana_*.snap
if [[ -z $DO_NOT_PUBLISH_SNAP ]]; then
echo --- publish: $CHANNEL channel
$DRYRUN snapcraft push solana_*.snap --release $CHANNEL
fi