Skip to content

Commit 2babe03

Browse files
bjoernricksmergify[bot]
authored andcommitted
Change: Use docker/meta-action for container tags and labels
Use the docker/meta-action for setting container labels and tags. This action is much more flexible then our own container-image-tags action. (cherry picked from commit 6c14726)
1 parent 8fd3859 commit 2babe03

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

.github/workflows/container.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,24 @@ jobs:
1414
steps:
1515
- name: Checkout repository
1616
uses: actions/checkout@v3
17-
- name: Gather container image tags
18-
uses: greenbone/actions/container-image-tags@v1
19-
id: container
17+
- name: Setup container meta information
18+
id: meta
19+
uses: docker/metadata-action@v4
20+
with:
21+
images: greenbone/ospd-openvas
22+
labels: |
23+
org.opencontainers.image.vendor=Greenbone
24+
org.opencontainers.image.base.name=debian/stable-slim
25+
flavor: latest=false # no latest container tag for git tags
26+
tags: |
27+
# create container tag for git tags
28+
type=ref,event=tag
29+
# use latest for stable branch
30+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
31+
type=raw,value=stable,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
32+
type=raw,value=oldstable,enable=${{ github.ref == format('refs/heads/{0}', 'oldstable') }}
33+
# use unstable for main branch
34+
type=raw,value=unstable,enable={{is_default_branch}}
2035
- name: Login to GitHub Container Registry
2136
uses: docker/login-action@v2
2237
with:
@@ -39,6 +54,7 @@ jobs:
3954
with:
4055
context: .
4156
push: true
42-
tags: ${{ steps.container.outputs.image-tags }}
4357
platforms: linux/amd64,linux/arm64
4458
file: .docker/prod.Dockerfile
59+
tags: ${{ steps.meta.outputs.tags }}
60+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)