Update docker-build-multiarch.yml
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 25 Nov 2020 08:30:43 +0000 (09:30 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 25 Nov 2020 08:30:43 +0000 (09:30 +0100)
.github/workflows/docker-build-multiarch.yml

index 8684f275d784992f4a4771ac5862f633a86a3779..0eab23cb894d3d5273351ba44b4aac0d67cbd4de 100644 (file)
@@ -24,26 +24,19 @@ 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
+          # If a manual tag was supplied, use that,
+          # otherwise use github_ref (==tag on release event)
           if [[ -n $MANUAL_TAG ]]; then
             VERSION=${MANUAL_TAG}
-
-          # 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}
+          else
+            VERSION=${GITHUB_REF}
           fi
-          TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}"
 
-          # 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
+          # create tags from versions, also assume this is latest
+          TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}${DOCKER_IMAGE}:latest"
 
           # Set output parameters.
           echo ::set-output name=tags::${TAGS}