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

View File

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