2018-11-11 08:19:04 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2018-10-30 15:31:52 -07:00
|
|
|
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
2019-06-07 15:07:20 -07:00
|
|
|
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:\\"
|
2022-12-19 08:00:14 -08:00
|
|
|
./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"
|
2019-06-07 15:07:20 -07:00
|
|
|
rustc -vV
|
|
|
|
cargo -vV
|
|
|
|
fi
|
|
|
|
|
2018-10-30 15:31:52 -07:00
|
|
|
DRYRUN=
|
2019-06-06 12:20:47 -07:00
|
|
|
if [[ -z $CI_BRANCH ]]; then
|
2018-10-30 15:31:52 -07:00
|
|
|
DRYRUN="echo"
|
2018-11-07 10:56:40 -08:00
|
|
|
CHANNEL=unknown
|
2018-10-30 15:31:52 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
eval "$(ci/channel-info.sh)"
|
|
|
|
|
2019-03-20 16:00:04 -07:00
|
|
|
TAG=
|
2019-06-06 12:20:47 -07:00
|
|
|
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.
|
2019-10-03 14:55:04 -07:00
|
|
|
exit 0
|
2018-11-07 10:26:07 -08:00
|
|
|
fi
|
|
|
|
|
2019-06-07 11:32:47 -07:00
|
|
|
case "$CI_OS_NAME" in
|
|
|
|
osx)
|
2022-01-03 16:51:25 -08:00
|
|
|
_cputype="$(uname -m)"
|
|
|
|
if [[ $_cputype = arm64 ]]; then
|
|
|
|
_cputype=aarch64
|
|
|
|
fi
|
|
|
|
TARGET=${_cputype}-apple-darwin
|
2019-03-20 13:37:55 -07:00
|
|
|
;;
|
2019-06-07 11:32:47 -07:00
|
|
|
linux)
|
2019-03-20 13:37:55 -07:00
|
|
|
TARGET=x86_64-unknown-linux-gnu
|
2019-06-07 11:32:47 -07:00
|
|
|
;;
|
|
|
|
windows)
|
2020-07-24 22:01:14 -07:00
|
|
|
TARGET=x86_64-pc-windows-msvc
|
2020-07-10 21:35:46 -07:00
|
|
|
# Enable symlinks used by some build.rs files
|
|
|
|
# source: https://stackoverflow.com/a/52097145/10242004
|
|
|
|
(
|
|
|
|
set -x
|
|
|
|
git --version
|
|
|
|
git config core.symlinks true
|
|
|
|
find . -type l -delete
|
|
|
|
git reset --hard
|
2022-08-10 06:59:14 -07:00
|
|
|
# patched crossbeam doesn't build on windows
|
|
|
|
sed -i 's/^crossbeam-epoch/#crossbeam-epoch/' Cargo.toml
|
2020-07-10 21:35:46 -07:00
|
|
|
)
|
2019-03-20 13:37:55 -07:00
|
|
|
;;
|
|
|
|
*)
|
2019-07-19 14:11:01 -07:00
|
|
|
echo CI_OS_NAME unset
|
|
|
|
exit 1
|
2019-03-20 13:37:55 -07:00
|
|
|
;;
|
|
|
|
esac
|
2018-11-07 10:26:07 -08:00
|
|
|
|
2020-06-09 15:40:41 -07:00
|
|
|
RELEASE_BASENAME="${RELEASE_BASENAME:=solana-release}"
|
|
|
|
TARBALL_BASENAME="${TARBALL_BASENAME:="$RELEASE_BASENAME"}"
|
|
|
|
|
2020-01-02 20:44:15 -08:00
|
|
|
echo --- Creating release tarball
|
2018-10-30 15:31:52 -07:00
|
|
|
(
|
|
|
|
set -x
|
2020-06-09 15:40:41 -07:00
|
|
|
rm -rf "${RELEASE_BASENAME:?}"/
|
|
|
|
mkdir "${RELEASE_BASENAME}"/
|
2019-03-13 16:11:50 -07:00
|
|
|
|
|
|
|
COMMIT="$(git rev-parse HEAD)"
|
|
|
|
|
2018-10-30 15:31:52 -07:00
|
|
|
(
|
2019-05-24 09:28:52 -07:00
|
|
|
echo "channel: $CHANNEL_OR_TAG"
|
2019-03-13 16:11:50 -07:00
|
|
|
echo "commit: $COMMIT"
|
|
|
|
echo "target: $TARGET"
|
2020-06-09 15:40:41 -07:00
|
|
|
) > "${RELEASE_BASENAME}"/version.yml
|
2018-10-30 15:31:52 -07:00
|
|
|
|
2019-11-12 21:01:04 -08:00
|
|
|
# Make CHANNEL available to include in the software version information
|
|
|
|
export CHANNEL
|
|
|
|
|
2019-03-14 19:41:05 -07:00
|
|
|
source ci/rust-version.sh stable
|
2021-04-07 11:41:40 -07:00
|
|
|
scripts/cargo-install-all.sh stable "${RELEASE_BASENAME}"
|
2018-11-12 21:47:48 -08:00
|
|
|
|
2020-06-09 15:40:41 -07:00
|
|
|
tar cvf "${TARBALL_BASENAME}"-$TARGET.tar "${RELEASE_BASENAME}"
|
|
|
|
bzip2 "${TARBALL_BASENAME}"-$TARGET.tar
|
|
|
|
cp "${RELEASE_BASENAME}"/bin/solana-install-init solana-install-init-$TARGET
|
|
|
|
cp "${RELEASE_BASENAME}"/version.yml "${TARBALL_BASENAME}"-$TARGET.yml
|
2018-10-30 15:31:52 -07:00
|
|
|
)
|
|
|
|
|
2020-10-20 12:13:27 -07:00
|
|
|
# Maybe tarballs are platform agnostic, only publish them from the Linux build
|
2020-01-02 21:49:56 -08:00
|
|
|
MAYBE_TARBALLS=
|
2019-06-13 09:50:09 -07:00
|
|
|
if [[ "$CI_OS_NAME" = linux ]]; then
|
2020-01-02 21:49:56 -08:00
|
|
|
(
|
|
|
|
set -x
|
2022-09-28 14:24:42 -07:00
|
|
|
sdk/sbf/scripts/package.sh
|
|
|
|
[[ -f sbf-sdk.tar.bz2 ]]
|
2020-01-02 21:49:56 -08:00
|
|
|
)
|
2022-09-28 14:24:42 -07:00
|
|
|
MAYBE_TARBALLS="sbf-sdk.tar.bz2"
|
2020-01-02 21:49:56 -08:00
|
|
|
fi
|
2020-01-02 20:44:15 -08:00
|
|
|
|
2018-12-13 21:44:50 -08:00
|
|
|
source ci/upload-ci-artifact.sh
|
2018-10-30 15:31:52 -07:00
|
|
|
|
2020-06-09 15:40:41 -07:00
|
|
|
for file in "${TARBALL_BASENAME}"-$TARGET.tar.bz2 "${TARBALL_BASENAME}"-$TARGET.yml solana-install-init-"$TARGET"* $MAYBE_TARBALLS; do
|
2019-06-26 14:37:15 -07:00
|
|
|
if [[ -n $DO_NOT_PUBLISH_TAR ]]; then
|
2020-04-16 13:54:29 -07:00
|
|
|
upload-ci-artifact "$file"
|
2019-06-26 14:37:15 -07:00
|
|
|
echo "Skipped $file due to DO_NOT_PUBLISH_TAR"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2019-06-07 11:32:47 -07:00
|
|
|
if [[ -n $BUILDKITE ]]; then
|
2019-06-07 21:35:51 -07:00
|
|
|
echo --- AWS S3 Store: "$file"
|
2020-11-20 08:27:34 -08:00
|
|
|
upload-s3-artifact "/solana/$file" s3://release.solana.com/"$CHANNEL_OR_TAG"/"$file"
|
|
|
|
|
|
|
|
echo Published to:
|
|
|
|
$DRYRUN ci/format-url.sh https://release.solana.com/"$CHANNEL_OR_TAG"/"$file"
|
2019-06-07 11:32:47 -07:00
|
|
|
|
|
|
|
if [[ -n $TAG ]]; then
|
2019-06-07 21:35:51 -07:00
|
|
|
ci/upload-github-release-asset.sh "$file"
|
2019-06-07 11:32:47 -07:00
|
|
|
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
|
2019-06-07 11:32:47 -07:00
|
|
|
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"/
|
2019-06-07 11:32:47 -07:00
|
|
|
|
|
|
|
if [[ -n $TAG ]]; then
|
2019-06-07 19:57:24 -07:00
|
|
|
# .travis.yaml uploads everything in the travis-release-upload/ directory to
|
2019-06-07 11:32:47 -07:00
|
|
|
# the associated Github Release
|
2019-06-07 15:07:20 -07:00
|
|
|
mkdir -p travis-release-upload/
|
2019-06-07 21:35:51 -07:00
|
|
|
cp -v "$file" travis-release-upload/
|
2019-06-07 11:32:47 -07:00
|
|
|
fi
|
2022-05-03 08:20:23 -07:00
|
|
|
elif [[ -n $GITHUB_ACTIONS ]]; then
|
|
|
|
mkdir -p github-action-s3-upload/"$CHANNEL_OR_TAG"
|
|
|
|
cp -v "$file" github-action-s3-upload/"$CHANNEL_OR_TAG"/
|
|
|
|
|
|
|
|
if [[ -n $TAG ]]; then
|
|
|
|
mkdir -p github-action-release-upload/
|
|
|
|
cp -v "$file" github-action-release-upload/
|
|
|
|
fi
|
2019-06-07 15:07:20 -07:00
|
|
|
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"
|
2019-03-20 16:00:04 -07:00
|
|
|
fi
|
2019-03-20 13:37:55 -07:00
|
|
|
done
|
2018-12-19 14:19:19 -08:00
|
|
|
|
|
|
|
echo --- ok
|