Automatic release to 22.7.0 #861
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Container Image Builds | |
on: | |
push: | |
branches: | |
- main | |
tags: ["v*"] | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
images: | |
name: Production Images | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: greenbone/actions/is-latest-tag@v3 | |
id: latest | |
- name: Setup container meta information | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ github.repository }} | |
labels: | | |
org.opencontainers.image.vendor=Greenbone | |
org.opencontainers.image.base.name=greenbone/gvm-libs | |
flavor: latest=false # no latest container tag for git tags | |
tags: | | |
# 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 | |
# 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: Set container build options | |
id: container-opts | |
run: | | |
if [[ "${{ github.ref_type }}" = 'tag' ]]; then | |
echo "version=stable" >> $GITHUB_OUTPUT | |
echo "gvm-libs-version=oldstable" >> $GITHUB_OUTPUT | |
else | |
echo "version=edge" >> $GITHUB_OUTPUT | |
echo "gvm-libs-version=oldstable-edge" >> $GITHUB_OUTPUT | |
fi | |
- name: Login to Docker Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push Container image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' && (github.ref_type == 'tag' || github.ref_name == 'main') }} | |
build-args: | | |
VERSION=${{ steps.container-opts.outputs.version }} | |
GVM_LIBS_VERSION=${{ steps.container-opts.outputs.gvm-libs-version }} | |
file: .docker/prod.Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |