Skip to content

Commit

Permalink
Implement tag versioning.
Browse files Browse the repository at this point in the history
Special thanks @meeDamian.
  • Loading branch information
junaruga committed Aug 16, 2019
1 parent b89ece1 commit 07d7e66
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ addons:
- cpio
env:
global:
- VERSION=4.0.0-5
- MAJOR_VERSION=4
- MINOR_VERSION=0
- PATCH_VERSION=0
- RELEASE_VERSION=5
- VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION-$RELEASE_VERSION
- TAG_VER=v$MAJOR_VERSION.$MINOR_VERSION
# See qemu-user-static's RPM spec file on Fedora to check the new version.
# https://src.fedoraproject.org/rpms/qemu/blob/master/f/qemu.spec
- DOCKER_SERVER=docker.io
Expand All @@ -33,7 +38,7 @@ script:
if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then
./publish.sh -v "$VERSION" -t "$GITHUB_TOKEN" -r "$REPO"
fi
- ./update.sh -v "$VERSION" -r "$REPO" -d "$DOCKER_REPO"
- ./update.sh -v "$VERSION" -t "$TAG_VER" -r "$REPO" -d "$DOCKER_REPO"
- docker images
- ./test.sh -d "$DOCKER_REPO"
after_success:
Expand Down
14 changes: 10 additions & 4 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ set -xe
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.

while getopts "r:v:d:" opt; do
while getopts "r:v:t:d:" opt; do
case "$opt" in
r) REPO=$OPTARG
;;
v) VERSION=$OPTARG
;;
t) TAG_VER=$OPTARG
;;
d) DOCKER_REPO=$OPTARG
;;
esac
Expand Down Expand Up @@ -58,11 +60,15 @@ for to_arch in $to_archs; do
FROM scratch
COPY qemu-${to_arch}-static /usr/bin/
EOF
docker build -t ${DOCKER_REPO}:$from_arch-$to_arch ${work_dir}
docker build -t ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} ${work_dir}
docker tag ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} ${DOCKER_REPO}:$from_arch-$to_arch
docker tag ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} ${DOCKER_REPO}:$to_arch-${TAG_VER}
docker tag ${DOCKER_REPO}:$from_arch-$to_arch ${DOCKER_REPO}:$to_arch
rm -rf "${work_dir}"
fi
done

docker build -t ${DOCKER_REPO}:latest "${out_dir}/latest"
docker build -t ${DOCKER_REPO}:register "${out_dir}/register"
docker build -t ${DOCKER_REPO}:${TAG_VER} "${out_dir}/latest"
docker tag ${DOCKER_REPO}:${TAG_VER} ${DOCKER_REPO}:latest
docker build -t ${DOCKER_REPO}:register-${TAG_VER} "${out_dir}/register"
docker tag ${DOCKER_REPO}:register-${TAG_VER} ${DOCKER_REPO}:register

0 comments on commit 07d7e66

Please sign in to comment.