Files
pistation/.gitea/workflows/publish-images.yml
T
SirBlob d4072baab4 Add Gitea Actions workflows
CI for both apps and the Rust crates, image publishing to GHCR, and the
arm64 kiosk package build.

Claude-Session: https://claude.ai/code/session_01SS9F92jb51bMCRCKem6QtD
2026-08-09 17:09:25 -04:00

82 lines
2.4 KiB
YAML

name: Build and Publish Docker Images
on:
push:
branches:
- main
tags:
- "v*"
release:
types: [published]
workflow_dispatch:
inputs:
platforms:
description: "Target platforms, comma-separated. Adding an arm target needs a privileged runner."
required: false
default: "linux/amd64"
env:
REGISTRY: ghcr.io
IMAGE_OWNER: sirblobby
DEFAULT_PLATFORMS: "linux/amd64"
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: pistation-server
dockerfile: server/Dockerfile
- name: pistation-web
dockerfile: apps/web-client/Dockerfile
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Resolve target platforms
id: platforms
run: echo "value=${{ github.event.inputs.platforms || env.DEFAULT_PLATFORMS }}" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
if: contains(steps.platforms.outputs.value, 'arm')
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: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ matrix.name }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.dockerfile }}
platforms: ${{ steps.platforms.outputs.value }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ matrix.name }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ matrix.name }}:buildcache,mode=max