minor fix of the snap publish script

This commit is contained in:
Andrey Meshkov 2020-05-14 23:28:01 +03:00
parent c64fdf9442
commit 3b258e536b
1 changed files with 32 additions and 22 deletions

View File

@ -10,13 +10,13 @@ SNAP_NAME="adguard-home"
LAUNCHPAD_CREDENTIALS_DIR=".local/share/snapcraft/provider/launchpad"
if [[ -z ${VERSION} ]]; then
VERSION=`git describe --abbrev=4 --dirty --always --tags`
VERSION=$(git describe --abbrev=4 --dirty --always --tags)
echo "VERSION env variable is not set, getting it from git: ${VERSION}"
fi
# If bash is interactive, set `-it` parameter for docker run
INTERACTIVE=""
if [ -t 0 ] ; then
if [ -t 0 ]; then
INTERACTIVE="-it"
fi
@ -80,14 +80,14 @@ function prepare() {
consumer_secret =
access_token = ${LAUNCHPAD_ACCESS_TOKEN}
access_secret = ${LAUNCHPAD_ACCESS_SECRET}
" > launchpad_credentials
" >launchpad_credentials
# Snapcraft login data
# It can be exported using snapcraft export-login command
echo "[login.ubuntu.com]
macaroon = ${SNAPCRAFT_MACAROON}
unbound_discharge = ${SNAPCRAFT_UBUNTU_DISCHARGE}
email = ${SNAPCRAFT_EMAIL}" > snapcraft_login
email = ${SNAPCRAFT_EMAIL}" >snapcraft_login
# Prepare the snap configuration
cp ${SNAPCRAFT_TMPL} ./snapcraft.yaml
@ -229,10 +229,15 @@ publish_docker() {
exit 1
fi
if [[ -n "$2" ]]; then
echo "ARCH is set to $2"
ARCH=$2 publish_snap_docker
else
ARCH=i386 publish_snap_docker
ARCH=arm64 publish_snap_docker
ARCH=armhf publish_snap_docker
ARCH=amd64 publish_snap_docker
fi
}
publish() {
@ -246,10 +251,15 @@ publish() {
exit 1
fi
if [[ -n "$2" ]]; then
echo "ARCH is set to $2"
ARCH=$2 publish_snap
else
ARCH=i386 publish_snap
ARCH=arm64 publish_snap
ARCH=armhf publish_snap
ARCH=amd64 publish_snap
fi
}
cleanup() {
@ -270,8 +280,8 @@ fi
case "$1" in
"build-docker") build_docker $2 ;;
"build") build $2 ;;
"publish-docker-beta") publish_docker beta ;;
"publish-docker-release") publish_docker stable ;;
"publish-docker-beta") publish_docker beta $2 ;;
"publish-docker-release") publish_docker stable $2 ;;
"publish-beta") publish beta ;;
"publish-release") publish stable ;;
"prepare") prepare ;;