69c52e2875
CI / Architecture Guardrails (push) Successful in 3m15s
CI / Typecheck (push) Successful in 4m15s
CI / Assistant Split Regression (push) Successful in 5m0s
CI / Lint (push) Successful in 5m4s
CI / Build (push) Failing after 1m41s
CI / E2E Tests (push) Has been skipped
CI / Fresh-Linux Docker Deploy (push) Has been skipped
CI / Release Images (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
The release-images job failed on every run because GHCR_USERNAME and
GHCR_TOKEN are not configured on the Gitea repo — and they don't need
to be: Gitea has its own container registry at the same host, reachable
with the auto-provisioned GITHUB_TOKEN.
- Derive the registry host from GITHUB_SERVER_URL (the Gitea base URL)
- Log in with $GITHUB_TOKEN + ${{ github.actor }}
- Tag images as <gitea-host>/<owner>/<repo>-{app,migrator}:sha-<commit>
- Add packages: write permission
- Drop the workflow_call secrets block — no external secrets needed
Consumers (deploy-staging.yml, deploy-prod.yml) that previously pulled
from ghcr.io/<owner>/<repo>-app will need to be updated to pull from
the Gitea registry next; flagging separately.
95 lines
3.2 KiB
YAML
95 lines
3.2 KiB
YAML
name: Release Image
|
|
|
|
# Reusable workflow: called from ci.yml after all checks pass.
|
|
# Can also be dispatched manually for rebuilds or tag overrides.
|
|
#
|
|
# Pushes to the Gitea container registry (the same host the workflow runs on)
|
|
# using the auto-provisioned GITHUB_TOKEN. No external secrets required.
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
image_tag:
|
|
description: Optional tag override, defaults to sha-<commit>
|
|
required: false
|
|
type: string
|
|
workflow_dispatch:
|
|
inputs:
|
|
image_tag:
|
|
description: Optional tag override, defaults to sha-<commit>
|
|
required: false
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
build-and-push:
|
|
name: Build And Push Images
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
run: docker buildx create --use --name ci-builder 2>/dev/null || true
|
|
|
|
- id: registry
|
|
name: Resolve Gitea registry host
|
|
# GITHUB_SERVER_URL is the Gitea base URL (e.g. https://gitea.hartmut-noerenberg.com).
|
|
# Strip the scheme to get the container-registry host.
|
|
run: |
|
|
host="${GITHUB_SERVER_URL#https://}"
|
|
host="${host#http://}"
|
|
echo "host=${host}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Login to Gitea container registry
|
|
# GITHUB_TOKEN is auto-provisioned by Gitea Actions for the running
|
|
# workflow; no manual secret configuration required.
|
|
run: |
|
|
echo "${{ secrets.GITHUB_TOKEN }}" | \
|
|
docker login "${{ steps.registry.outputs.host }}" \
|
|
-u "${{ github.actor }}" --password-stdin
|
|
|
|
- id: vars
|
|
name: Compute image refs
|
|
run: |
|
|
owner="$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')"
|
|
repo="$(basename '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')"
|
|
image_tag="${{ inputs.image_tag }}"
|
|
if [ -z "${image_tag}" ]; then
|
|
image_tag="sha-${GITHUB_SHA}"
|
|
fi
|
|
host="${{ steps.registry.outputs.host }}"
|
|
echo "app_image=${host}/${owner}/${repo}-app:${image_tag}" >> "$GITHUB_OUTPUT"
|
|
echo "migrator_image=${host}/${owner}/${repo}-migrator:${image_tag}" >> "$GITHUB_OUTPUT"
|
|
|
|
# Guardrail anchor: target: runner
|
|
- name: Build and push app image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.prod
|
|
target: runner
|
|
push: true
|
|
tags: ${{ steps.vars.outputs.app_image }}
|
|
cache-from: type=gha,scope=app
|
|
cache-to: type=gha,mode=max,scope=app
|
|
|
|
# Guardrail anchor: target: migrator
|
|
- name: Build and push migrator image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.prod
|
|
target: migrator
|
|
push: true
|
|
tags: ${{ steps.vars.outputs.migrator_image }}
|
|
cache-from: type=gha,scope=migrator
|
|
cache-to: type=gha,mode=max,scope=migrator
|
|
|
|
- name: Release summary
|
|
run: |
|
|
echo "App image: ${{ steps.vars.outputs.app_image }}"
|
|
echo "Migrator image: ${{ steps.vars.outputs.migrator_image }}"
|