Add builder workflow

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-09-14 16:16:53 +01:00
parent f3162e1620
commit 2376e2a574

View File

@@ -0,0 +1,48 @@
name: Build & Push Builder Image
on:
workflow_call:
inputs:
image:
description: "Full image name to build and push"
required: true
type: string
username:
required: true
type: string
secrets:
password:
required: true
outputs:
tag:
description: "The built image reference"
value: ${{ jobs.builder.outputs.tag }}
jobs:
builder:
runs-on: nix
outputs:
tag: ${{ steps.build.outputs.tag }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Log In to Registry
run: buildah login --username "${{ inputs.username }}" --password "${{ secrets.password }}" "$(echo "${{ inputs.image }}" | cut -d/ -f1)"
- name: Pull Builder Cache
run: buildah pull ${{ inputs.image }} || true
- name: Build Builder Image
id: build
run: |
buildah build --layers -f .gitea/Containerfile -t ${{ inputs.image }} .
digest=$(skopeo inspect containers-storage:${{ inputs.image }} | jq -r '.Digest')
ref="${{ inputs.image }}@${digest}"
echo "tag=$ref" >> $GITEA_OUTPUT
- name: Push Builder Image
run: skopeo copy containers-storage:${{ inputs.image }} docker://${{ inputs.image }}