Files
nidus/.github/workflows/docker-release.yml
T
arnefandCopilot 63b59a73fe Add CI workflow to build and publish multi-arch Docker images on tag/release
Builds linux/amd64 + linux/arm64 images via Buildx/QEMU whenever a "v*"
tag is pushed or a release is published, and pushes them (tagged with
the version and "latest") to this repository's own container registry.
Written in plain GitHub Actions syntax, which Gitea Actions runs as-is.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-21 16:37:29 +02:00

65 lines
2.0 KiB
YAML

name: Docker release
# Builds and publishes a multi-arch (linux/amd64 + linux/arm64) Docker
# image whenever a version tag (e.g. "v1.2.3") is pushed, or a release is
# published for one. Written against the GitHub Actions syntax, which
# Gitea Actions runs unmodified — the ${{ github.* }} context and
# secrets.GITHUB_TOKEN are provided as compatibility aliases by Gitea's
# act runner, so this workflow works as-is on either platform.
#
# The image is pushed to this server's own container registry, addressed
# as "<host>/<owner>/<repo>" (e.g. git.example.com/owner/nidus on Gitea,
# or ghcr.io/owner/nidus if this repo is ever mirrored to GitHub).
on:
push:
tags:
- "v*"
release:
types: [published]
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Determine registry, image name, and tags
id: vars
run: |
registry="$(echo "${{ github.server_url }}" | sed -E 's#^https?://##')"
image_name="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
image="${registry}/${image_name}"
version="${GITHUB_REF_NAME#v}"
{
echo "registry=${registry}"
echo "image=${image}"
echo "tags=${image}:${version},${image}:latest"
} >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: ${{ steps.vars.outputs.registry }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.vars.outputs.tags }}