solana/ci/publish-snap.sh

66 lines
1.3 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
2018-06-18 13:45:53 -07:00
cd "$(dirname "$0")/.."
2018-11-26 17:54:40 -08:00
# This job doesn't run within a container, try once to upgrade tooling on a
# version check failure
ci/version-check-with-upgrade.sh stable
2018-10-24 19:36:50 -07:00
2018-06-18 13:45:53 -07:00
DRYRUN=
2018-11-12 21:16:53 -08:00
if [[ -z $BUILDKITE_BRANCH ]]; then
2018-06-18 13:45:53 -07:00
DRYRUN="echo"
fi
2018-11-12 21:16:53 -08:00
if ./ci/is-pr.sh; then
DRYRUN="echo"
CHANNEL="none (pullrequest)"
fi
eval "$(ci/channel-info.sh)"
2018-10-02 15:30:07 -07:00
if [[ -z $CHANNEL ]]; then
echo Unable to determine channel to publish into, exiting.
exit 1
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
2019-01-12 10:43:43 -08:00
echo "--- build: $CHANNEL channel"
2018-06-18 13:45:53 -07:00
snapcraft
2018-06-24 21:24:08 -07:00
source ci/upload-ci-artifact.sh
upload-ci-artifact solana_*.snap
2018-06-24 10:10:55 -07:00
if [[ -z $DO_NOT_PUBLISH_SNAP ]]; then
2019-01-12 10:43:43 -08:00
echo "--- publish: $CHANNEL channel"
$DRYRUN snapcraft push solana_*.snap --release "$CHANNEL"
fi