diff --git a/.travis.yml b/.travis.yml index aa8b935..eff3358 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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: diff --git a/update.sh b/update.sh index 8fd5638..3bc6bc5 100755 --- a/update.sh +++ b/update.sh @@ -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 @@ -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