Fix publish
All checks were successful
CI / Backend tests (push) Successful in 19s
CI / Frontend build (push) Successful in 22s
CI / Frontend lint (push) Successful in 47s
CI / Frontend unit tests (push) Successful in 46s
CI / Playwright e2e (push) Successful in 59s
Docker / build-and-push (push) Successful in 1m53s

This commit is contained in:
Andras Schmelczer 2026-05-31 18:31:22 +01:00
commit 006ae81c3b

View file

@ -3,48 +3,73 @@ name: Docker
on: on:
push: push:
branches: [master] branches: [master]
tags: ["v*"]
workflow_dispatch: workflow_dispatch:
env:
REGISTRY: ${{ vars.REGISTRY || 'ghcr.io' }}
IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
build-and-push: build-and-push:
runs-on: docker runs-on: docker
permissions:
contents: read
packages: write
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Log in to container registry - name: Install Docker CLI
uses: docker/login-action@v3 run: |
with: ARCH=$(uname -m)
registry: ${{ env.REGISTRY }} curl -fsSL "https://download.docker.com/linux/static/stable/${ARCH}/docker-27.5.1.tgz" \
username: ${{ github.actor }} | tar xz --strip-components=1 -C /usr/local/bin docker/docker
password: ${{ secrets.GITHUB_TOKEN }} docker --version
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: https://github.com/docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
- name: Resolve registry vars
id: registry
env:
CONTAINER_REGISTRY_HOST: ${{ vars.CONTAINER_REGISTRY_HOST }}
run: |
host="${CONTAINER_REGISTRY_HOST:-${{ gitea.server_url }}}"
host="${host#https://}"
host="${host#http://}"
host="${host%/}"
if [ "$host" = "forgejo:3000" ]; then
host="127.0.0.1:13000"
fi
repo=$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
owner="${repo%%/*}"
{
echo "host=${host}"
echo "owner=${owner}"
echo "image=${host}/${repo}"
} >> "$GITHUB_OUTPUT"
- name: Log in to Forgejo Container Registry
uses: https://github.com/docker/login-action@v3
with:
registry: ${{ steps.registry.outputs.host }}
username: ${{ steps.registry.outputs.owner }}
password: ${{ secrets.FORGEJO_PACKAGE_TOKEN }}
- name: Extract metadata - name: Extract metadata
id: meta id: meta
uses: docker/metadata-action@v5 uses: https://github.com/docker/metadata-action@v5
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ steps.registry.outputs.image }}
tags: | tags: |
type=raw,value=latest type=sha,format=short
type=sha,prefix=sha-,format=short type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push - name: Build and push
uses: docker/build-push-action@v6 uses: https://github.com/docker/build-push-action@v6
with: with:
context: . context: .
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha cache-from: type=registry,ref=${{ steps.registry.outputs.image }}:buildcache
cache-to: type=gha,mode=max cache-to: type=registry,ref=${{ steps.registry.outputs.image }}:buildcache,mode=max