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