Merge pull request #6224 from peb-adr/tagging

unique version tag for docker images
This commit is contained in:
Emanuel Schütze 2021-09-24 10:36:18 +02:00 committed by GitHub
commit cda2c0c21c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ on: [push, workflow_dispatch]
env:
IMAGE_VERSION: 4.0.0-dev
TAG_SUFFIX: -$(date +%Y%m%d)-${GITHUB_SHA::7}
jobs:
build:
name: Builds Docker images
@ -58,6 +59,10 @@ jobs:
env:
DOCKER_BUILDKIT: 1
run: |
if [ "${{ matrix.service.name }}" = "openslides-client" ]
then
eval echo ${IMAGE_VERSION}${TAG_SUFFIX} > src/assets/version.txt
fi
if [ "${{ matrix.service.args }}" != "" ]
then
export BUILD_ARGS="--build-arg MODULE=${{ matrix.service.args.MODULE }}
@ -76,5 +81,7 @@ jobs:
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
docker tag ${{ matrix.service.name }} $IMAGE_ID:$IMAGE_VERSION
docker push $IMAGE_ID:$IMAGE_VERSION
docker tag ${{ matrix.service.name }} ${IMAGE_ID}:$(eval echo ${IMAGE_VERSION}${TAG_SUFFIX})
docker tag ${{ matrix.service.name }} ${IMAGE_ID}:latest
docker push ${IMAGE_ID}:$(eval echo ${IMAGE_VERSION}${TAG_SUFFIX})
docker push ${IMAGE_ID}:latest