ci: revert to single multi-arch build job (simplest working version)
One build job pushes linux/amd64 + linux/arm64 together — buildx creates the multi-arch :next manifest automatically. No manifest job, no PAT, no repo filter. Node 24.
This commit is contained in:
1 parent
ab069c4b91
commit
dfe3556987
1 file changed
+21
-79
@@ -8,23 +8,29 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
IMAGE_NAME: lezi-fun/forumlify-deploy
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linux-amd64:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
- uses: docker/setup-buildx-action@v3
|
uses: actions/checkout@v4
|
||||||
- uses: docker/login-action@v3
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: lezi-fun
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GHCR_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Metadata
|
|
||||||
|
- name: Extract metadata (tags, labels)
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
@@ -32,80 +38,16 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
type=sha,prefix=git-
|
type=sha,prefix=git-
|
||||||
- name: Build & push linux/amd64
|
|
||||||
|
- name: Build and push (linux/amd64 + linux/arm64)
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64, linux/arm64
|
||||||
tags: ${{ steps.meta.outputs.tags }}-amd64
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha,scope=amd64
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max,scope=amd64
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
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
|
|
||||||
Reference in new issue
Block a user