diff options
Diffstat (limited to 'dist/linux/deploy2dockerhub.sh')
-rwxr-xr-x | dist/linux/deploy2dockerhub.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/dist/linux/deploy2dockerhub.sh b/dist/linux/deploy2dockerhub.sh new file mode 100755 index 000000000..63b9fc8d9 --- /dev/null +++ b/dist/linux/deploy2dockerhub.sh @@ -0,0 +1,32 @@ +#! /bin/sh + +set -e + +. dist/linux/travis-utils.sh +. dist/ansi_color.sh +#disable_color + +# Skip deploy if we are in stage 0 (i.e. IMAGE="") and there is no '[ci images]' in the commit message +if [ "$1" = "skip" ] || [ "${1}$(echo $2 | grep -o '\[ci images\]')" = "" ]; then + printf "${ANSI_GREEN}SKIP DEPLOY2DOCKERHUB$ANSI_NOCOLOR\n"; + exit 0; +fi + +case $1 in + "") FILTER="/";; + *) FILTER="/ghdl /pkg";; +esac + +docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" +for key in $FILTER; do + for tag in `echo $(docker images ghdl$key* | awk -F ' ' '{print $1 ":" $2}') | cut -d ' ' -f2-`; do + if [ "$tag" = "REPOSITORY:TAG" ]; then break; fi + echo "travis_fold:start:`echo $tag | grep -oP 'ghdl/\K.*'`" + travis_time_start + printf "$ANSI_YELLOW[DOCKER push] ${tag}$ANSI_NOCOLOR\n" + docker push $tag + travis_time_finish + echo "travis_fold:end:`echo $tag | grep -oP 'ghdl/\K.*'`" + done +done +docker logout |