mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
684b61ac2b
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Leonard Cohnen <lc@edgeless.systems>
83 lines
2.6 KiB
YAML
83 lines
2.6 KiB
YAML
# Required permissions:
|
|
#
|
|
# permissions:
|
|
# packages: write # for docker/build-push-action
|
|
#
|
|
name: Build micro service
|
|
description: Build and upload a container image for a Constellation micro-service
|
|
inputs:
|
|
name:
|
|
description: "Name of the micro-service"
|
|
required: true
|
|
projectVersion:
|
|
description: "Version of the micro-service"
|
|
default: "0.0.0"
|
|
required: false
|
|
dockerfile:
|
|
description: "Path to the services Dockerfile"
|
|
required: true
|
|
pushTag:
|
|
description: "Use this image tag"
|
|
required: false
|
|
githubToken:
|
|
description: "GitHub authorization token"
|
|
required: true
|
|
cosignPublicKey:
|
|
description: "Cosign public key"
|
|
required: false
|
|
cosignPrivateKey:
|
|
description: "Cosign private key"
|
|
required: false
|
|
cosignPassword:
|
|
description: "Password for Cosign private key"
|
|
required: false
|
|
|
|
# Linux runner only (Docker required)
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Determine pseudo version
|
|
id: pseudo-version
|
|
uses: ./.github/actions/pseudo_version
|
|
|
|
- name: Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e # v4.4.0
|
|
with:
|
|
images: |
|
|
ghcr.io/${{ github.repository }}/${{ inputs.name }}
|
|
tags: |
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
type=raw,value=${{ inputs.pushTag }},enable=${{ '' != inputs.pushTag }}
|
|
type=raw,value=${{ steps.pseudo-version.outputs.version }},enable=${{ '' != steps.pseudo-version.outputs.version }}
|
|
type=ref,event=branch
|
|
|
|
- name: Log in to the Container registry
|
|
id: docker-login
|
|
uses: ./.github/actions/container_registry_login
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ inputs.githubToken }}
|
|
|
|
- name: Build and push container image
|
|
id: build-micro-service
|
|
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
|
|
with:
|
|
context: .
|
|
file: ${{ inputs.dockerfile }}
|
|
target: release
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
build-args: |
|
|
PROJECT_VERSION=${{ inputs.projectVersion }}
|
|
|
|
- name: Generate SBOM
|
|
if: inputs.cosignPublicKey != '' && inputs.cosignPrivateKey != '' && inputs.cosignPassword != ''
|
|
uses: ./.github/actions/container_sbom
|
|
with:
|
|
containerReference: ghcr.io/${{ github.repository }}/${{ inputs.name }}@${{ steps.build-micro-service.outputs.digest }}
|
|
cosignPublicKey: ${{ inputs.cosignPublicKey }}
|
|
cosignPrivateKey: ${{ inputs.cosignPrivateKey }}
|
|
cosignPassword: ${{ inputs.cosignPassword }}
|