Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change: Run container image builds also for pull requests
Browse files Browse the repository at this point in the history
Ensure that container builds are successfull in pull requests too. This
avoids adding changes to a PR that will break the container image
builds.
bjoernricks committed Aug 22, 2022

Verified

This commit was signed with the committer’s verified signature.
bjoernricks Björn Ricks
1 parent e02cbf7 commit 798224a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -2,8 +2,10 @@ name: Container Image Builds

on:
push:
branches: [ main ]
branches: [ main, stable, oldstable ]
tags: ["v*"]
pull_request:
branches: [ main, stable, oldstable ]
workflow_dispatch:
repository_dispatch:

@@ -18,21 +20,23 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: greenbone/gvmd
images: ${{ github.repository }}
labels: |
org.opencontainers.image.vendor=Greenbone
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
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
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -45,7 +49,7 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
push: true
push: ${{ github.event_name != 'pull_request' }}
file: .docker/prod.Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
@@ -61,21 +65,23 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: greenbone/gvmd-build
images: ${{ github.repository }}-build
labels: |
org.opencontainers.image.vendor=Greenbone
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
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 DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -89,12 +95,13 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
push: true
push: ${{ github.event_name != 'pull_request' }}
file: .docker/build.Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Trigger libtheia container build
if: github.event_name != 'pull_request'
run: |
curl -X POST https://api.github.com/repos/greenbone/libtheia/actions/workflows/container.yml/dispatches \
-H "Accept: application/vnd.github.v3+json" \

0 comments on commit 798224a

Please sign in to comment.