Choose deployment based on tag or master branch depending on Travis env vars

pull/38/head
Clement Michaud 2017-06-01 22:46:42 +02:00
parent b804882ce0
commit 0d58d5bf23
1 changed files with 11 additions and 7 deletions

View File

@ -1,16 +1,14 @@
#!/bin/bash #!/bin/bash
if [ "$TRAVIS_BRANCH" == "master" ]; then # Parameters:
# TAG - The name of the tag to use for publishing in Dockerhub
#
function deploy_on_dockerhub {
echo "=======================================" echo "======================================="
echo "Authelia will be deployed on Dockerhub." echo "Authelia will be deployed on Dockerhub."
echo "=======================================" echo "======================================="
echo "TRAVIS_TAG='$TRAVIS_TAG'"
TAG=latest
if [ ! -z "$TRAVIS_TAG" ]; then
TAG=$TRAVIS_TAG
fi
TAG=$1
IMAGE_NAME=clems4ever/authelia IMAGE_NAME=clems4ever/authelia
IMAGE_WITH_TAG=$IMAGE_NAME:$TAG IMAGE_WITH_TAG=$IMAGE_NAME:$TAG
@ -21,7 +19,13 @@ if [ "$TRAVIS_BRANCH" == "master" ]; then
docker tag $IMAGE_NAME $IMAGE_WITH_TAG; docker tag $IMAGE_NAME $IMAGE_WITH_TAG;
docker push $IMAGE_WITH_TAG; docker push $IMAGE_WITH_TAG;
echo "Docker image deployed successfully." echo "Docker image deployed successfully."
}
if [ "$TRAVIS_BRANCH" == "master" ]; then
deploy_on_dockerhub latest
elif [ ! -z "$TRAVIS_TAG" ]; then
deploy_on_dockerhub $TRAVIS_TAG
else else
echo "Docker image will not be deployed on Dockerhub." echo "Docker image will not be deployed on Dockerhub."
fi fi