Skip to content

Commit

Permalink
Change: Update creating tags for container images
Browse files Browse the repository at this point in the history
Use new scheme for container image tags.
  • Loading branch information
bjoernricks committed Dec 15, 2022
1 parent 777ab41 commit a035fb5
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
Expand All @@ -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 }}
Expand Down

0 comments on commit a035fb5

Please sign in to comment.