From dc852131954cca0fab1b39f3d3fef687db55808b Mon Sep 17 00:00:00 2001 From: Bernhard B Date: Fri, 10 Apr 2020 20:39:02 +0200 Subject: [PATCH] added possibility to publish multiple tags --- publish.sh | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/publish.sh b/publish.sh index ce30af0..aa832b1 100644 --- a/publish.sh +++ b/publish.sh @@ -1,10 +1,11 @@ #!/bin/bash -while getopts v: option +while getopts v:t: option do case "${option}" in v) VERSION=${OPTARG};; +t) TAG=${OPTARG};; esac done @@ -14,8 +15,20 @@ then exit 1 fi +if [ -z "$TAG" ] +then + echo "Please provide a valid tag with the -t flag. e.g: -t stable (supported tags: dev, stable)" + exit 1 +fi + +if [[ "$TAG" != "dev" && "$TAG" != "stable" ]]; then + echo "Please use either dev or stable as tag" + exit 1 +fi + echo "This will upload a new signal-cli-rest-api to dockerhub" echo "Version: $VERSION" +echo "Tag: $TAG" echo "" read -r -p "Are you sure? [y/N] " response @@ -27,10 +40,18 @@ case "$response" in docker buildx create --name multibuilder docker buildx use multibuilder + + if [[ "$TAG" == "stable" ]]; then + docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t bbernhard/signal-cli-rest-api:$VERSION . --push + docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t bbernhard/signal-cli-rest-api:latest . --push + fi - docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t bbernhard/signal-cli-rest-api:$VERSION . --push - docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t bbernhard/signal-cli-rest-api:latest . --push - ;; + if [[ "$TAG" == "dev" ]]; then + docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t bbernhard/signal-cli-rest-api:${VERSION}-dev . --push + docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t bbernhard/signal-cli-rest-api:latest-dev . --push + fi + + ;; *) echo "Aborting" exit 1