Files
vboxstock/.github/workflows/publish-container.yml
T
mfwadejr 3e31721b0e
Publish container / publish (push) Has been cancelled
Build multi-arch images so pulls work regardless of runner/host CPU
The first successful Gitea-side publish only produced a manifest for
whatever architecture the self-hosted Actions runner happens to be,
which didn't match the amd64 ZimaOS host pulling it ("no matching
manifest for linux/amd64"). Adds QEMU + Buildx setup and builds for
linux/amd64 and linux/arm64 explicitly so the published image works on
any host regardless of what CPU built it.
2026-09-21 22:54:18 +00:00

66 lines
1.9 KiB
YAML

name: Publish container
on:
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out source
uses: actions/checkout@v6
- name: Determine target registry
id: registry
run: |
if [ "${{ github.server_url }}" = "https://github.com" ]; then
echo "registry=ghcr.io" >> "$GITHUB_OUTPUT"
echo "image=ghcr.io/mfwadejr/vboxstock" >> "$GITHUB_OUTPUT"
else
host="$(printf '%s' '${{ github.server_url }}' | sed -E 's#^https?://##')"
echo "registry=$host" >> "$GITHUB_OUTPUT"
echo "image=$host/marvin/vboxstock" >> "$GITHUB_OUTPUT"
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Sign in to container registry
uses: docker/login-action@v3
with:
registry: ${{ steps.registry.outputs.registry }}
username: ${{ github.actor }}
password: ${{ github.server_url == 'https://github.com' && secrets.GITHUB_TOKEN || secrets.REGISTRY_TOKEN }}
- name: Generate image tags
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.registry.outputs.image }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=tag
type=sha
- name: Build and publish image
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_SHA=${{ github.sha }}
BUILD_DATE=${{ github.event.repository.updated_at || github.run_id }}