Files
forumlify/.github/workflows/docker-ghcr.yml
T
lezi-fun ab069c4b91 ci: fixed image name + PAT login (publish from upstream next to lezi-fun GHCR)
- IMAGE_NAME pinned to lezi-fun/forumlify-deploy (not github.repository)
- login uses secrets.GHCR_TOKEN (PAT with packages:write) so any repo
  (upstream Furrium/forumlify included) can publish to lezi-fun GHCR
- removed repo filter
2026-08-11 19:26:44 +08:00

112 lines
3.1 KiB
YAML

name: Build & Push Docker to GHCR
on:
push:
branches: [next, main]
tags: ['v*']
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: lezi-fun/forumlify-deploy
jobs:
linux-amd64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: lezi-fun
password: ${{ secrets.GHCR_TOKEN }}
- name: Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=sha,prefix=git-
- name: Build & push linux/amd64
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}-amd64
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=amd64
cache-to: type=gha,mode=max,scope=amd64
linux-arm64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: lezi-fun
password: ${{ secrets.GHCR_TOKEN }}
- name: Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=sha,prefix=git-
- name: Build & push linux/arm64
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/arm64
tags: ${{ steps.meta.outputs.tags }}-arm64
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=arm64
cache-to: type=gha,mode=max,scope=arm64
manifest:
needs: [linux-amd64, linux-arm64]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: lezi-fun
password: ${{ secrets.GHCR_TOKEN }}
- name: Metadata (base tags)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=sha,prefix=git-
- name: Merge multi-arch manifests
shell: bash
run: |
set -e
TAGS=$(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ' ')
for tag in $TAGS; do
echo "merging: $tag (amd64 + arm64)"
docker manifest create "$tag" --amend "$tag-amd64" --amend "$tag-arm64"
docker manifest push "$tag"
done