Skip to content

Commit 834b601

Browse files
authored
Tag latest docker image before deploying it (#86)
1 parent 93ed6e3 commit 834b601

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ matrix:
2121
- env: TEST_ENV=ubuntu-18.04-llvm-6.0
2222
deploy:
2323
- provider: script
24-
script: scripts/docker-deploy.sh "$TRAVIS_TAG"
24+
script: scripts/docker-deploy.sh "$TRAVIS_COMMIT" "$TRAVIS_TAG"
2525
on:
2626
tags: true
2727
- provider: script
28-
script: scripts/docker-deploy.sh latest
28+
script: scripts/docker-deploy.sh "$TRAVIS_COMMIT" latest
2929
on:
3030
branch: master
3131
- env: TEST_ENV=ubuntu-18.04-llvm-5.0

scripts/docker-deploy.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
set -euo pipefail
66
IFS=$'\n\t'
77

8-
IMAGE="scalabindgen/scala-native-bindgen:${1#v}"
9-
echo "Pushing $IMAGE"
8+
SOURCE_IMAGE="scalabindgen/scala-native-bindgen:${1}"
9+
TARGET_IMAGE="scalabindgen/scala-native-bindgen:${2#v}"
10+
echo "Pushing $TARGET_IMAGE from $SOURCE_IMAGE"
1011

11-
docker tag scalabindgen/scala-native-bindgen:latest "$IMAGE"
12+
if [[ "$SOURCE_IMAGE" != "$TARGET_IMAGE" ]]; then
13+
docker tag "$SOURCE_IMAGE" "$TARGET_IMAGE"
14+
fi
1215

1316
echo "$DOCKER_PASSWORD" | docker login --password-stdin --username "$DOCKER_USERNAME"
1417

15-
docker push "$IMAGE"
18+
docker push "$TARGET_IMAGE"

0 commit comments

Comments
 (0)