solana/ci/publish-tarball.sh

151 lines
3.6 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
cd "$(dirname "$0")/.."
if [[ -n $APPVEYOR ]]; then
# Bootstrap rust build environment
source ci/env.sh
source ci/rust-version.sh
appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
2019-09-08 09:47:20 -07:00
export USERPROFILE="D:\\"
./rustup-init -yv --default-toolchain $rust_stable --default-host x86_64-pc-windows-msvc
2019-09-08 09:47:20 -07:00
export PATH="$PATH:/d/.cargo/bin"
rustc -vV
cargo -vV
fi
DRYRUN=
if [[ -z $CI_BRANCH ]]; then
DRYRUN="echo"
CHANNEL=unknown
fi
eval "$(ci/channel-info.sh)"
TAG=
if [[ -n "$CI_TAG" ]]; then
CHANNEL_OR_TAG=$CI_TAG
TAG="$CI_TAG"
2018-11-06 15:03:58 -08:00
else
CHANNEL_OR_TAG=$CHANNEL
fi
2018-11-07 10:26:07 -08:00
if [[ -z $CHANNEL_OR_TAG ]]; then
2019-12-12 16:15:31 -08:00
echo +++ Unable to determine channel or tag to publish into, exiting.
exit 0
2018-11-07 10:26:07 -08:00
fi
case "$CI_OS_NAME" in
osx)
TARGET=x86_64-apple-darwin
;;
linux)
TARGET=x86_64-unknown-linux-gnu
;;
windows)
TARGET=x86_64-pc-windows-msvc
;;
*)
echo CI_OS_NAME unset
exit 1
;;
esac
2018-11-07 10:26:07 -08:00
2020-01-02 20:44:15 -08:00
echo --- Creating release tarball
(
set -x
rm -rf solana-release/
mkdir solana-release/
COMMIT="$(git rev-parse HEAD)"
(
echo "channel: $CHANNEL_OR_TAG"
echo "commit: $COMMIT"
echo "target: $TARGET"
) > solana-release/version.yml
# Make CHANNEL available to include in the software version information
export CHANNEL
source ci/rust-version.sh stable
scripts/cargo-install-all.sh +"$rust_stable" --use-move solana-release
2018-11-12 21:47:48 -08:00
# Reduce the Windows archive size until
2019-07-21 09:21:15 -07:00
# https://github.com/appveyor/ci/issues/2997 is fixed
if [[ -n $APPVEYOR ]]; then
2019-09-26 13:36:51 -07:00
rm -f \
solana-release/bin/solana-validator.exe \
solana-release/bin/solana-bench-exchange.exe \
2019-07-21 09:21:15 -07:00
fi
2019-07-21 09:21:15 -07:00
tar cvf solana-release-$TARGET.tar solana-release
bzip2 solana-release-$TARGET.tar
cp solana-release/bin/solana-install-init solana-install-init-$TARGET
cp solana-release/version.yml solana-release-$TARGET.yml
)
2019-06-13 09:50:09 -07:00
# Metrics tarball is platform agnostic, only publish it from Linux
MAYBE_METRICS_TARBALL=
if [[ "$CI_OS_NAME" = linux ]]; then
metrics/create-metrics-tarball.sh
MAYBE_METRICS_TARBALL=solana-metrics.tar.bz2
fi
2020-01-02 20:44:15 -08:00
(
set -x
sdk/bpf/scripts/package.sh
[[ -f bpf-sdk.tar.bz2 ]]
)
source ci/upload-ci-artifact.sh
2020-01-02 20:44:15 -08:00
for file in solana-release-$TARGET.tar.bz2 solana-release-$TARGET.yml solana-install-init-"$TARGET"* $MAYBE_METRICS_TARBALL bpf-sdk.tar.bz2; do
2019-06-26 14:37:15 -07:00
upload-ci-artifact "$file"
if [[ -n $DO_NOT_PUBLISH_TAR ]]; then
echo "Skipped $file due to DO_NOT_PUBLISH_TAR"
continue
fi
if [[ -n $BUILDKITE ]]; then
2019-06-07 21:35:51 -07:00
echo --- AWS S3 Store: "$file"
(
set -x
$DRYRUN docker run \
--rm \
--env AWS_ACCESS_KEY_ID \
--env AWS_SECRET_ACCESS_KEY \
--volume "$PWD:/solana" \
eremite/aws-cli:2018.12.18 \
2019-06-07 21:35:51 -07:00
/usr/bin/s3cmd --acl-public put /solana/"$file" s3://release.solana.com/"$CHANNEL_OR_TAG"/"$file"
echo Published to:
2019-06-07 21:35:51 -07:00
$DRYRUN ci/format-url.sh http://release.solana.com/"$CHANNEL_OR_TAG"/"$file"
)
if [[ -n $TAG ]]; then
2019-06-07 21:35:51 -07:00
ci/upload-github-release-asset.sh "$file"
fi
elif [[ -n $TRAVIS ]]; then
2019-06-07 19:57:24 -07:00
# .travis.yml uploads everything in the travis-s3-upload/ directory to release.solana.com
mkdir -p travis-s3-upload/"$CHANNEL_OR_TAG"
2019-06-07 21:35:51 -07:00
cp -v "$file" travis-s3-upload/"$CHANNEL_OR_TAG"/
if [[ -n $TAG ]]; then
2019-06-07 19:57:24 -07:00
# .travis.yaml uploads everything in the travis-release-upload/ directory to
# the associated Github Release
mkdir -p travis-release-upload/
2019-06-07 21:35:51 -07:00
cp -v "$file" travis-release-upload/
fi
elif [[ -n $APPVEYOR ]]; then
# Add artifacts for .appveyor.yml to upload
2019-06-07 21:35:51 -07:00
appveyor PushArtifact "$file" -FileName "$CHANNEL_OR_TAG"/"$file"
fi
done
echo --- ok