chore: update workflow
This commit is contained in:
parent
60929d53c2
commit
a8457e96bf
1 changed files with 11 additions and 5 deletions
16
.github/workflows/docker-multiplatform.yml
vendored
16
.github/workflows/docker-multiplatform.yml
vendored
|
@ -20,21 +20,27 @@ jobs:
|
|||
id: prep
|
||||
run: |
|
||||
DOCKER_IMAGE=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPOSITORY#*/}
|
||||
VERSION=main
|
||||
|
||||
# If this is git tag, use the tag name as a docker tag
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
TAGS="${DOCKER_IMAGE}:${VERSION}"
|
||||
fi
|
||||
|
||||
# If this is git branch, use the branch name as a docker tag
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/heads/}
|
||||
TAGS="${DOCKER_IMAGE}:${VERSION}"
|
||||
fi
|
||||
|
||||
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}"
|
||||
# If the VERSION looks like a version number, assume that
|
||||
# this is the most recent version of the image and also
|
||||
# tag it 'latest'.
|
||||
# tag it 'latest'. This is done by just specifying the ${DOCKER_IMAGE}
|
||||
# without a tag.
|
||||
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
|
||||
TAGS="$TAGS,${DOCKER_IMAGE}"
|
||||
fi
|
||||
|
||||
|
||||
# Set output parameters.
|
||||
echo ::set-output name=tags::${TAGS}
|
||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||
|
|
Loading…
Reference in a new issue