From f45dc4a7b8520bfe30f3b1e95cce3195ce44992a Mon Sep 17 00:00:00 2001
From: CrazyMax <crazy-max@users.noreply.github.com>
Date: Sat, 12 Sep 2020 21:38:49 +0200
Subject: [PATCH] Fix example

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
---
 .github/workflows/example.yml | 5 ++---
 README.md                     | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml
index 337eab7..1f05215 100644
--- a/.github/workflows/example.yml
+++ b/.github/workflows/example.yml
@@ -42,14 +42,13 @@ jobs:
           elif [[ $GITHUB_REF == refs/pull/* ]]; then
             VERSION=pr-${{ github.event.number }}
           fi
-          if [[ $GITHUB_REF != refs/tags/* ]] && [[ "${{ github.event_name }}" = "push"  ]]; then
-            TAGS="${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
-          fi
           TAGS="${DOCKER_IMAGE}:${VERSION}"
           if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
             MINOR=${VERSION%.*}
             MAJOR=${MINOR%.*}
             TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
+          elif [ "${{ github.event_name }}" = "push" ]; then
+            TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
           fi
           echo ::set-output name=version::${VERSION}
           echo ::set-output name=tags::${TAGS}
diff --git a/README.md b/README.md
index 437c162..9180b4c 100644
--- a/README.md
+++ b/README.md
@@ -360,14 +360,13 @@ jobs:
           elif [[ $GITHUB_REF == refs/pull/* ]]; then
             VERSION=pr-${{ github.event.number }}
           fi
-          if [[ $GITHUB_REF != refs/tags/* ]] && [[ "${{ github.event_name }}" = "push"  ]]; then
-            TAGS="${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
-          fi
           TAGS="${DOCKER_IMAGE}:${VERSION}"
           if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
             MINOR=${VERSION%.*}
             MAJOR=${MINOR%.*}
             TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
+          elif [ "${{ github.event_name }}" = "push" ]; then
+            TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
           fi
           echo ::set-output name=version::${VERSION}
           echo ::set-output name=tags::${TAGS}