2019-01-09 14:39:21 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e # fail on any error
|
|
|
|
set -u # treat unset variables as error
|
|
|
|
|
2019-01-10 10:58:30 +01:00
|
|
|
# some necromancy:
|
2019-02-14 14:14:42 +01:00
|
|
|
# gsub(/"/, "", $2) deletes "qoutes"
|
2019-01-10 10:58:30 +01:00
|
|
|
# gsub(/ /, "", $2) deletes whitespaces
|
|
|
|
TRACK=`awk -F '=' '/^track/ {gsub(/"/, "", $2); gsub(/ /, "", $2); print $2}' ./util/version/Cargo.toml`
|
|
|
|
echo Track is: $TRACK
|
2019-01-09 14:39:21 +01:00
|
|
|
|
2019-02-20 10:52:43 +01:00
|
|
|
# Choose snap release channel based on parity ethereum version track
|
2019-01-09 14:39:21 +01:00
|
|
|
case ${TRACK} in
|
|
|
|
nightly) export GRADE="devel" CHANNEL="edge";;
|
|
|
|
beta) export GRADE="stable" CHANNEL="beta";;
|
|
|
|
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
|
|
|
|
|
2019-02-20 10:52:43 +01:00
|
|
|
# Release untagged versions from branches to the candidate snap channel
|
|
|
|
case ${CI_COMMIT_REF_NAME} in
|
|
|
|
beta|stable) export GRADE="stable" CHANNEL="candidate";;
|
|
|
|
esac
|
|
|
|
|
2019-02-14 14:14:42 +01:00
|
|
|
VERSION="v"$VERSION
|
2019-01-09 14:39:21 +01:00
|
|
|
SNAP_PACKAGE="parity_"$VERSION"_"$BUILD_ARCH".snap"
|
|
|
|
|
|
|
|
echo "__________Create snap package__________"
|
|
|
|
echo "Release channel :" $GRADE " Branch/tag: " $CI_COMMIT_REF_NAME
|
|
|
|
echo $VERSION:$GRADE:$BUILD_ARCH
|
2019-02-13 11:00:41 +01:00
|
|
|
# cat scripts/snap/snapcraft.template.yaml | envsubst '$VERSION:$GRADE:$BUILD_ARCH:$CARGO_TARGET' > snapcraft.yaml
|
|
|
|
# a bit more necromancy (substitutions):
|
|
|
|
pwd
|
|
|
|
cd /builds/$CI_PROJECT_PATH/scripts/snap/
|
|
|
|
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' \
|
|
|
|
snapcraft.template.yaml > /builds/$CI_PROJECT_PATH/snapcraft.yaml
|
|
|
|
cd /builds/$CI_PROJECT_PATH
|
|
|
|
pwd
|
|
|
|
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
|
|
|
|
|
|
|
|
echo $SNAPCRAFT_LOGIN_PARITY_BASE64 | base64 --decode > snapcraft.login
|
|
|
|
snapcraft login --with snapcraft.login
|
|
|
|
snapcraft push --release $CHANNEL $SNAP_PACKAGE
|
|
|
|
snapcraft status parity
|
|
|
|
snapcraft logout
|