3
0
Fork 0
mirror of https://gitea.com/docker/build-push-action.git synced 2024-11-22 17:39:38 +01:00

Merge pull request #121 from crazy-max/fix-example

Fix example
This commit is contained in:
CrazyMax 2020-09-12 21:40:32 +02:00 committed by GitHub
commit a368cdd67a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View file

@ -42,14 +42,13 @@ jobs:
elif [[ $GITHUB_REF == refs/pull/* ]]; then elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }} VERSION=pr-${{ github.event.number }}
fi fi
if [[ $GITHUB_REF != refs/tags/* ]] && [[ "${{ github.event_name }}" = "push" ]]; then
TAGS="${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
fi
TAGS="${DOCKER_IMAGE}:${VERSION}" TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
MINOR=${VERSION%.*} MINOR=${VERSION%.*}
MAJOR=${MINOR%.*} MAJOR=${MINOR%.*}
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest" 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 fi
echo ::set-output name=version::${VERSION} echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS} echo ::set-output name=tags::${TAGS}

View file

@ -360,14 +360,13 @@ jobs:
elif [[ $GITHUB_REF == refs/pull/* ]]; then elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }} VERSION=pr-${{ github.event.number }}
fi fi
if [[ $GITHUB_REF != refs/tags/* ]] && [[ "${{ github.event_name }}" = "push" ]]; then
TAGS="${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
fi
TAGS="${DOCKER_IMAGE}:${VERSION}" TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
MINOR=${VERSION%.*} MINOR=${VERSION%.*}
MAJOR=${MINOR%.*} MAJOR=${MINOR%.*}
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest" 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 fi
echo ::set-output name=version::${VERSION} echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS} echo ::set-output name=tags::${TAGS}