Skip to content

Commit

Permalink
Change: Adjust building the build container image for semver releases
Browse files Browse the repository at this point in the history
The gvmd repository will use semver in future as the scanner repos do
now too. Therefore adjust the workflow for building and uploading the
gvmd build image.
  • Loading branch information
bjoernricks committed Jun 9, 2023
1 parent 45846ee commit f10fb52
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .docker/build.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Define ARG we use through the build
ARG VERSION=edge
ARG VERSION=stable

# We want gvm-libs to be ready so we use the build docker image of gvm-libs
FROM greenbone/gvm-libs:$VERSION
Expand Down
29 changes: 19 additions & 10 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ name: Build Container Image Builds

on:
push:
branches: [ main, stable, oldstable ]
branches:
- main
tags: ["v*"]
paths:
- .github/workflows/build-container.yml
- .docker/build.Dockerfile
pull_request:
branches: [ main, stable, oldstable ]
branches:
- main
paths:
- .github/workflows/build-container.yml
- .docker/build.Dockerfile
Expand All @@ -25,6 +27,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: greenbone/actions/is-latest-tag@v2
id: latest
- name: Setup container meta information
id: meta
uses: docker/metadata-action@v4
Expand All @@ -35,15 +39,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 version, major.minor and major for tags
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# use edge for default branch
type=edge
# set label for non-published pull request builds
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}}
# when a new git tag is created set stable and a latest tags
type=raw,value=latest,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
type=raw,value=stable,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
Expand Down

0 comments on commit f10fb52

Please sign in to comment.