Skip to content

Commit

Permalink
Add: push.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalholthaus committed Jun 18, 2024
1 parent e9a1b84 commit b175d11
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build and Push to Greenbone Registry

on:
push:
branches: [ main ]
tags: ["v*"]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
ref-name:
type: string
description: 'The ref to build a container image from. For example a tag v23.0.0.'
required: true

jobs:
building:
runs-on: self-hosted-generic
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
ref: ${{ inputs.ref-name || '' }}

- uses: greenbone/actions/is-latest-tag@v3
id: latest
with:
tag-name: ${{ inputs.ref-name || github.ref_name }}

- name: Set container build options
id: container-opts
run: |
if [[ "${{ github.ref_type }}" = 'tag' ]]; then
echo "version=stable" >> $GITHUB_OUTPUT
else
echo "version=edge" >> $GITHUB_OUTPUT
fi
- name: Build and Push Container
id: build-and-push
uses: greenbone/actions/container-build-push-generic@v3
with:
build-docker-file: .docker/prod.Dockerfile
build-args: |
VERSION=${{ steps.container-opts.outputs.version }}
cosign-key: ${{ secrets.COSIGN_KEY_OPENSIGHT }}
cosign-key-password: ${{ secrets.COSIGN_KEY_PASSWORD_OPENSIGHT }}
cosign-tlog-upload: "false"
image-url: community/gsa
image-labels: |
org.opencontainers.image.vendor=Greenbone
org.opencontainers.image.base.name=greenbone/gsad
image-tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=edge
type=ref,event=pr
type=raw,value=latest,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
type=raw,value=stable,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
image-platforms: linux/amd64,linux/arm64
registry: ${{ secrets.GREENBONE_REGISTRY }}
registry-username: ${{ secrets.GREENBONE_REGISTRY_USER }}
registry-password: ${{ secrets.GREENBONE_REGISTRY_TOKEN }}

0 comments on commit b175d11

Please sign in to comment.