cert-manager-webhook-example/.github/workflows/build-images.yaml
2024-05-27 18:29:19 +02:00

48 lines
1.1 KiB
YAML

name: Build docker images
on:
workflow_call:
inputs:
tags:
description: 'Tags to build the image for (separated by a whitespace)'
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: src/go.mod
cache-dependency-path: src/go.sum
- name: Get go dependencies
run: |
cd src
go mod download
- name: Setup ko
# KO is a tool for building go container images https://ko.build/
uses: ko-build/setup-ko@v0.6
# KO is configured to use GHCR as the registry
- name: Format tags with a comma
id: format-tags
run: echo "TAGS=$(echo ${{ inputs.tags }} | tr ' ' ',')" >> $GITHUB_OUTPUT
- name: Build images
run: |
cd src
ko build --tags="${{ steps.format-tags.outputs.TAGS }}" --platform=linux/amd64,linux/arm64 --bare --sbom=none