Fix docker image tag with semantic version for releases (#2548)

* Fix docker tag with semantic version for releases

* Prepend latest docker tag with tagprefix in cache-from
This commit is contained in:
Ivan Lopez 2022-05-16 13:26:33 +02:00 committed by GitHub
parent 2b11981b08
commit a2a99f79b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,8 @@ on:
push:
branches:
- master
tags:
- v*
jobs:
build:
@ -36,12 +38,12 @@ jobs:
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: |
${{ matrix.repository }}
tags: |
type=ref,event=tag,prefix=${{ matrix.tagprefix }}
type=semver,pattern={{version}},prefix=${{ matrix.tagprefix }}
type=sha,format=long,prefix=${{ matrix.tagprefix }}
type=sha,format=long,prefix=,enable=${{ matrix.default }}
type=raw,value=latest,prefix=${{ matrix.tagprefix }}
@ -57,10 +59,10 @@ jobs:
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
file: ${{ matrix.dockerfile }}
tags: ${{ steps.meta.outputs.tags }}
push: true
cache-from: type=registry,ref=${{ matrix.repository }}:latest
cache-from: type=registry,ref=${{ matrix.repository }}:${{ matrix.tagprefix }}latest
cache-to: type=inline