Skip to content

Commit

Permalink
Publish each master build to docker hub
Browse files Browse the repository at this point in the history
  • Loading branch information
c-w committed Apr 29, 2019
1 parent 8c0eb4d commit 55e6523
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 release-${TRAVIS_TAG}
on:
repo: chakki-works/doccano
tags: true
6 changes: 3 additions & 3 deletions tools/cd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tag>" >&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"

0 comments on commit 55e6523

Please sign in to comment.