2019-01-09 14:39:21 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e # fail on any error
|
|
|
|
set -u # treat unset variables as error
|
|
|
|
|
2019-02-25 12:56:38 +01:00
|
|
|
# prepare variables
|
2019-05-31 13:27:00 +02:00
|
|
|
TRACK=$(cat ./tools/TRACK)
|
|
|
|
echo "Track is: ${TRACK}"
|
|
|
|
VERSION=$(cat ./tools/VERSION)
|
2020-03-25 17:16:51 +01:00
|
|
|
SNAP_PACKAGE="openethereum_"$VERSION"_"$BUILD_ARCH".snap"
|
|
|
|
# Choose snap release channel based on OpenEthereum version track
|
2019-01-09 14:39:21 +01:00
|
|
|
case ${TRACK} in
|
|
|
|
nightly) export GRADE="devel" CHANNEL="edge";;
|
|
|
|
stable) export GRADE="stable" CHANNEL="stable";;
|
2019-01-10 10:58:30 +01:00
|
|
|
*) echo "No release" && exit 0;;
|
2019-01-09 14:39:21 +01:00
|
|
|
esac
|
|
|
|
|
|
|
|
echo "__________Create snap package__________"
|
2019-05-31 13:27:00 +02:00
|
|
|
echo "Release channel :" $GRADE " Branch/tag: " $CI_COMMIT_REF_NAME "Track: " ${TRACK}
|
2019-02-25 12:56:38 +01:00
|
|
|
echo $VERSION:$GRADE:$BUILD_ARCH:$CARGO_TARGET
|
|
|
|
|
2019-02-12 15:37:54 +01:00
|
|
|
sed -e 's/$VERSION/'"$VERSION"'/g' \
|
|
|
|
-e 's/$GRADE/'"$GRADE"'/g' \
|
|
|
|
-e 's/$BUILD_ARCH/'"$BUILD_ARCH"'/g' \
|
|
|
|
-e 's/$CARGO_TARGET/'"$CARGO_TARGET"'/g' \
|
2019-02-25 12:56:38 +01:00
|
|
|
scripts/snap/snapcraft.template.yaml > snapcraft.yaml
|
|
|
|
|
2019-02-12 15:37:54 +01:00
|
|
|
apt update
|
|
|
|
apt install -y --no-install-recommends rhash
|
2019-01-09 14:39:21 +01:00
|
|
|
cat snapcraft.yaml
|
|
|
|
snapcraft --target-arch=$BUILD_ARCH
|
|
|
|
ls *.snap
|
|
|
|
|
|
|
|
echo "__________Calculating checksums__________"
|
|
|
|
rhash --sha256 $SNAP_PACKAGE -o $SNAP_PACKAGE".sha256"
|
|
|
|
cat $SNAP_PACKAGE".sha256"
|
|
|
|
|
|
|
|
echo "__________Releasing snap package__________"
|
|
|
|
echo "Release channel :" $CHANNEL " Branch/tag: " $CI_COMMIT_REF_NAME
|
|
|
|
|
2020-03-25 17:16:51 +01:00
|
|
|
echo $SNAPCRAFT_LOGIN_OPENETHEREUM_BASE64 | base64 --decode > snapcraft.login
|
2019-01-09 14:39:21 +01:00
|
|
|
snapcraft login --with snapcraft.login
|
|
|
|
snapcraft push --release $CHANNEL $SNAP_PACKAGE
|
2020-03-25 17:16:51 +01:00
|
|
|
snapcraft status openethereum
|
2019-01-09 14:39:21 +01:00
|
|
|
snapcraft logout
|