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 3baa6ed commit 9ef0f5c
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 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 ]
tags: ['v*']
branches: [main, stable, oldstable]
tags: ["v*"]
pull_request:
branches: [ main, stable , oldstable ]
branches: [main, stable, oldstable]
workflow_dispatch:

jobs:
Expand All @@ -30,17 +30,20 @@ jobs:
labels: |
org.opencontainers.image.vendor=Greenbone
org.opencontainers.image.base.name=greenbone/gsad
flavor: latest=false # no latest container tag for git tags
flavor: latest=false # no auto 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 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: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand All @@ -49,7 +52,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 9ef0f5c

Please sign in to comment.