From 6faf28e71d2ec5711cbc665e364485e773c1262d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 15 Dec 2022 13:46:35 +0000 Subject: [PATCH] Change: Update creating tags for container images (#1888) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use new scheme for container image tags. (cherry picked from commit a035fb52d6fb10c1431bd3cd07f8710ca9c6280a) Co-authored-by: Björn Ricks --- .github/workflows/container.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 55f14d8d4..f0543cfe5 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -2,10 +2,10 @@ name: Container Image Builds on: push: - branches: [ main, stable, oldstable ] + branches: [main, stable, oldstable] tags: ["v*"] pull_request: - branches: [ main, stable, oldstable ] + branches: [main, stable, oldstable] workflow_dispatch: repository_dispatch: @@ -26,15 +26,20 @@ jobs: org.opencontainers.image.base.name=debian/stable-slim flavor: latest=false # no latest container tag for git tags tags: | - # create container tag for git tags - type=ref,event=tag + # use container tag for git tags + type=match,pattern=v(.*),group=1 + # use latest for latest tag from stable branch + type=raw,value=latest,enable=${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v22.4') }} + # use stable for latest 22.4 tag + type=raw,value=stable,enable=${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v22.4') }} + # use oldstable for latest 21.4 tag + type=raw,value=oldstable,enable=${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v21.4') }} + # use edge for default branch + type=edge + # use branch-sha otherwise for pushes to branches other then main (will not be uploaded) + type=raw,value={{branch}}-{{sha}},enable=${{ github.ref_type == 'branch' && github.event_name == 'push' && github.ref_name != 'main' }} + # use pr-$PR_ID for pull requests (will not be uploaded) type=ref,event=pr - # use latest for stable branch - type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }} - type=raw,value=stable,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }} - type=raw,value=oldstable,enable=${{ github.ref == format('refs/heads/{0}', 'oldstable') }} - # use unstable for main branch - type=raw,value=unstable,enable={{is_default_branch}} - name: Login to Docker Registry if: github.event_name != 'pull_request' uses: docker/login-action@v2 @@ -49,7 +54,7 @@ jobs: uses: docker/build-push-action@v3 with: context: . - push: ${{ github.event_name != 'pull_request' }} + push: ${{ github.event_name != 'pull_request' && (github.ref_type == 'tag' || github.ref_name == 'main') }} file: .docker/prod.Dockerfile platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }}