From 0d5ff1436aa395eb2c788663049784a3054af67c Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Mon, 29 Apr 2019 18:21:42 -0400 Subject: [PATCH] Publish each master build to docker hub --- .travis.yml | 8 ++++++-- tools/cd.sh | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index e2d5bc54..a0e19a2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,11 @@ script: deploy: - provider: script - script: tools/cd.sh + script: tools/cd.sh travis-${TRAVIS_BUILD_NUMBER} + on: + branch: master + + - provider: script + script: tools/cd.sh ${TRAVIS_TAG} on: - repo: chakki-works/doccano tags: true diff --git a/tools/cd.sh b/tools/cd.sh index 35bf0241..1b6b46df 100755 --- a/tools/cd.sh +++ b/tools/cd.sh @@ -2,14 +2,14 @@ if [[ -z "${DOCKER_USERNAME}" ]]; then echo "Missing DOCKER_USERNAME environment variable" >&2; exit 1; fi if [[ -z "${DOCKER_PASSWORD}" ]]; then echo "Missing DOCKER_PASSWORD environment variable" >&2; exit 1; fi -if [[ -z "${TRAVIS_TAG}" ]]; then echo "Missing TRAVIS_TAG environment variable" >&2; exit 1; fi +if [[ -z "$1" ]]; then echo "Usage: $0 " >&2; exit 1; fi set -o errexit docker build -t "${DOCKER_USERNAME}/doccano:latest" . -docker build -t "${DOCKER_USERNAME}/doccano:${TRAVIS_TAG}" . +docker build -t "${DOCKER_USERNAME}/doccano:$1" . echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin docker push "${DOCKER_USERNAME}/doccano:latest" -docker push "${DOCKER_USERNAME}/doccano:${TRAVIS_TAG}" +docker push "${DOCKER_USERNAME}/doccano:$1"