Skip to content

Commit

Permalink
Change: Build container images for pull requests too
Browse files Browse the repository at this point in the history
Ensure to not break the container images with changed in pull requests.

(cherry picked from commit 94e09d4)
  • Loading branch information
bjoernricks committed Aug 23, 2022
1 parent a02d0cb commit eb1d217
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches: [ main, stable, oldstable ]
tags: ["v*"]
pull_request:
branches: [ main, stable, oldstable ]
workflow_dispatch:

jobs:
Expand All @@ -18,21 +20,23 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: greenbone/ospd-openvas
images: ${{ github.repository }}
labels: |
org.opencontainers.image.vendor=Greenbone
org.opencontainers.image.base.name=debian/stable-slim
org.opencontainers.image.base.name=greenbone/openvas-scanner
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 GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -45,7 +49,7 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
push: true
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
file: .docker/prod.Dockerfile
tags: ${{ steps.meta.outputs.tags }}
Expand Down

0 comments on commit eb1d217

Please sign in to comment.