Add less specific versions to docker release

Eg. if version 1.2.3 is released the following tags will be updated/created `1.2.3`, `1.2`, `1`, `latest`.
This commit is contained in:
Viktor Strate Kløvedal
2020-08-15 15:36:41 +02:00
committed by GitHub
parent 6193197c71
commit fadfc396ad

View File

@@ -41,10 +41,11 @@ jobs:
if [ "${{ github.event_name }}" = "schedule" ]; then
VERSION=nightly
fi
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest"
if [[ $VERSION =~ ^(([0-9]{1,3})\.[0-9]{1,3})\.[0-9]{1,3}$ ]]; then
VERSION_MINOR=${BASH_REMATCH[1]}
VERSION_MAJOR=${BASH_REMATCH[2]}
TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest --tag ${DOCKER_IMAGE}:${VERSION_MINOR} --tag ${DOCKER_IMAGE}:${VERSION_MAJOR}"
fi
echo ::set-output name=docker_username::${DOCKER_USERNAME}