Skip to content

Commit 37ec78d

Browse files
committed
ci: git flow
1 parent 32eb22c commit 37ec78d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

.travis.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ before_install:
2828
- 'echo " \"experimental\": \"enabled\"" >> $HOME/.docker/config.json'
2929
- 'echo "}" >> $HOME/.docker/config.json'
3030
- sudo service docker restart
31+
# To have `DOCKER_USER` and `DOCKER_PASS`
32+
# use `travis env set`.
33+
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
3134

3235
install:
3336
# For cross buidling our images
@@ -55,9 +58,11 @@ before_script:
5558
- if [ -n "$TRAVIS_TAG" ]; then
5659
VERSION=$(echo "${TRAVIS_TAG}" | sed -e 's/\(.*\)[-v]\(.*\)/\1\2/g');
5760
fi
58-
- if [ "${TRAVIS_BRANCH}" == 'stable' ]; then
61+
- if [ "${TRAVIS_BRANCH}" == 'master' ]; then
5962
VERSION="stable";
6063
fi
64+
# replace / with - in version
65+
- VERSION=$(echo "${VERSION}" | sed 's|/|-|g');
6166

6267
script:
6368
- make build-nocache NAME=${NAME} VERSION=${VERSION}-${TARGET_ARCH}
@@ -72,9 +77,6 @@ before_deploy:
7277
- docker run -d --name test_image ${NAME}:${VERSION}-${TARGET_ARCH} sleep 10
7378
- sleep 5
7479
- sudo docker ps | grep -q test_image
75-
# To have `DOCKER_USER` and `DOCKER_PASS`
76-
# use `travis env set`.
77-
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
7880
- make tag NAME=${NAME} VERSION=${VERSION}-${TARGET_ARCH}
7981

8082
deploy:
@@ -89,21 +91,21 @@ jobs:
8991
install: skip
9092
script: skip
9193
after_deploy:
92-
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
94+
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
9395
- docker manifest create ${NAME}:${VERSION} ${NAME}:${VERSION}-amd64 ${NAME}:${VERSION}-arm32v7 ${NAME}:${VERSION}-arm64v8;
9496
docker manifest annotate ${NAME}:${VERSION} ${NAME}:${VERSION}-amd64 --os linux --arch amd64;
9597
docker manifest annotate ${NAME}:${VERSION} ${NAME}:${VERSION}-arm32v7 --os linux --arch arm --variant v7;
9698
docker manifest annotate ${NAME}:${VERSION} ${NAME}:${VERSION}-arm64v8 --os linux --arch arm64 --variant v8;
9799

98-
# The latest tag is coming from the stable branch of the repo
99-
- if [ "${TRAVIS_BRANCH}" == 'stable' ]; then
100+
# The latest tag is coming from the master branch of the repo
101+
- if [ "${TRAVIS_BRANCH}" == 'master' ]; then
100102
docker manifest create ${NAME}:latest ${NAME}:${VERSION}-amd64 ${NAME}:${VERSION}-arm32v7 ${NAME}:${VERSION}-arm64v8;
101103
docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-amd64 --os linux --arch amd64;
102104
docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-arm32v7 --os linux --arch arm --variant v7;
103105
docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-arm64v8 --os linux --arch arm64 --variant v8;
104106
fi
105107

106108
- docker manifest push ${NAME}:${VERSION};
107-
if [ "${TRAVIS_BRANCH}" == 'stable' ]; then
109+
if [ "${TRAVIS_BRANCH}" == 'master' ]; then
108110
docker manifest push ${NAME}:latest;
109111
fi

0 commit comments

Comments
 (0)