From 7467c8580a1f6693f22533d2250097f8736654f0 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sat, 28 Nov 2020 20:11:13 +0100 Subject: [PATCH] Update docker-build-multiarch.yml --- .github/workflows/docker-build-multiarch.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-build-multiarch.yml b/.github/workflows/docker-build-multiarch.yml index 0eab23cb..8684f275 100644 --- a/.github/workflows/docker-build-multiarch.yml +++ b/.github/workflows/docker-build-multiarch.yml @@ -24,19 +24,26 @@ jobs: id: prep run: | DOCKER_IMAGE=${{ secrets.DOCKER_USERNAME }}/music-assistant + VERSION=latest SHORTREF=${GITHUB_SHA::8} MANUAL_TAG=${{ github.event.inputs.tag }} - # If a manual tag was supplied, use that, - # otherwise use github_ref (==tag on release event) + # If a manual tag was supplied, use that if [[ -n $MANUAL_TAG ]]; then VERSION=${MANUAL_TAG} - else - VERSION=${GITHUB_REF} + + # If this is git tag, use the tag name as a docker tag + elif [[ $GITHUB_REF == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/v} fi + TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}" - # create tags from versions, also assume this is latest - TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}${DOCKER_IMAGE}:latest" + # If the VERSION looks like a version number, assume that + # this is the most recent version of the image and also + # tag it 'latest'. + if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + TAGS="$TAGS,${DOCKER_IMAGE}:latest" + fi # Set output parameters. echo ::set-output name=tags::${TAGS} -- 2.34.1