Skip to content

Commit 0bdbb05

Browse files
author
Roman Volosatovs
committed
.travis.yml,travis-push.sh: Push development images on each build
1 parent 082b37b commit 0bdbb05

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,3 @@ script:
1919
deploy:
2020
provider: script
2121
script: bash travis-push.sh
22-
on:
23-
tags: true

travis-push.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
#!/usr/bin/env bash
22
set -xe
33

4-
if [ ${TRAVIS_TAG} ]; then
5-
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
4+
function tag_and_push {
5+
docker tag "${IMAGE_NAME}:latest" "${IMAGE_NAME}:${1}" && docker push "${IMAGE_NAME}:${1}"
6+
}
7+
8+
9+
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
10+
if [ "${TRAVIS_TAG}" ]; then
611
TAG=${TRAVIS_TAG#"v"}
712
if [[ ${TAG} =~ 3\.[0-9]+\.[0-9]+$ ]]; then
8-
docker push ${IMAGE_NAME}:latest
9-
for name in ${IMAGE_NAME}:${TAG} ${IMAGE_NAME}:${TAG%.*} ${IMAGE_NAME}:${TAG%.*.*}; do
10-
docker tag ${IMAGE_NAME}:latest ${name} && docker push ${name}
11-
done
13+
docker push "${IMAGE_NAME}:latest"
14+
tag_and_push "${TAG}"
15+
tag_and_push "${TAG%.*}"
16+
tag_and_push "${TAG%.*.*}";
1217
else
13-
docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:${TAG} && docker push ${IMAGE_NAME}:${TAG}
18+
tag_and_push "${TAG}"
1419
fi
20+
elif [ "${TRAVIS_BRANCH}" = "master" ]; then
21+
tag_and_push "nightly"
22+
else
23+
tag_and_push "development"
1524
fi

0 commit comments

Comments
 (0)