Skip to content

Commit 07d7e66

Browse files
committed
Implement tag versioning.
Special thanks @meeDamian.
1 parent b89ece1 commit 07d7e66

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ addons:
1212
- cpio
1313
env:
1414
global:
15-
- VERSION=4.0.0-5
15+
- MAJOR_VERSION=4
16+
- MINOR_VERSION=0
17+
- PATCH_VERSION=0
18+
- RELEASE_VERSION=5
19+
- VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION-$RELEASE_VERSION
20+
- TAG_VER=v$MAJOR_VERSION.$MINOR_VERSION
1621
# See qemu-user-static's RPM spec file on Fedora to check the new version.
1722
# https://src.fedoraproject.org/rpms/qemu/blob/master/f/qemu.spec
1823
- DOCKER_SERVER=docker.io
@@ -33,7 +38,7 @@ script:
3338
if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then
3439
./publish.sh -v "$VERSION" -t "$GITHUB_TOKEN" -r "$REPO"
3540
fi
36-
- ./update.sh -v "$VERSION" -r "$REPO" -d "$DOCKER_REPO"
41+
- ./update.sh -v "$VERSION" -t "$TAG_VER" -r "$REPO" -d "$DOCKER_REPO"
3742
- docker images
3843
- ./test.sh -d "$DOCKER_REPO"
3944
after_success:

update.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ set -xe
44
# A POSIX variable
55
OPTIND=1 # Reset in case getopts has been used previously in the shell.
66

7-
while getopts "r:v:d:" opt; do
7+
while getopts "r:v:t:d:" opt; do
88
case "$opt" in
99
r) REPO=$OPTARG
1010
;;
1111
v) VERSION=$OPTARG
1212
;;
13+
t) TAG_VER=$OPTARG
14+
;;
1315
d) DOCKER_REPO=$OPTARG
1416
;;
1517
esac
@@ -58,11 +60,15 @@ for to_arch in $to_archs; do
5860
FROM scratch
5961
COPY qemu-${to_arch}-static /usr/bin/
6062
EOF
61-
docker build -t ${DOCKER_REPO}:$from_arch-$to_arch ${work_dir}
63+
docker build -t ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} ${work_dir}
64+
docker tag ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} ${DOCKER_REPO}:$from_arch-$to_arch
65+
docker tag ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} ${DOCKER_REPO}:$to_arch-${TAG_VER}
6266
docker tag ${DOCKER_REPO}:$from_arch-$to_arch ${DOCKER_REPO}:$to_arch
6367
rm -rf "${work_dir}"
6468
fi
6569
done
6670

67-
docker build -t ${DOCKER_REPO}:latest "${out_dir}/latest"
68-
docker build -t ${DOCKER_REPO}:register "${out_dir}/register"
71+
docker build -t ${DOCKER_REPO}:${TAG_VER} "${out_dir}/latest"
72+
docker tag ${DOCKER_REPO}:${TAG_VER} ${DOCKER_REPO}:latest
73+
docker build -t ${DOCKER_REPO}:register-${TAG_VER} "${out_dir}/register"
74+
docker tag ${DOCKER_REPO}:register-${TAG_VER} ${DOCKER_REPO}:register

0 commit comments

Comments
 (0)