Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 94 additions & 10 deletions .github/workflows/image-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:
dockerfile:
required: true
type: string
platforms:
required: true
type: string
is-latest:
required: false
type: boolean
Expand All @@ -39,11 +36,23 @@ on:

jobs:
release:
runs-on: [self-hosted, ARM64, stable]
runs-on: ${{ matrix.builder }}
strategy:
matrix:
include:
- builder: ubuntu-latest
platform: linux/amd64
- builder: ubuntu-24.04-arm
platform: linux/arm64
environment: DOCKER_HUB
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Prepare artifact key
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV

- name: Docker meta
id: meta
Expand All @@ -65,9 +74,6 @@ jobs:
type=raw,value=latest,enable=${{ inputs.is-latest }}
type=raw,value=${{ inputs.volto-version }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -78,13 +84,91 @@ jobs:
password: ${{ secrets.registry-password }}

- name: Build and push
id: build
uses: docker/build-push-action@v6
with:
platforms: ${{ inputs.platforms }}
platforms: ${{ matrix.platform }}
context: ${{ inputs.context }}
file: ${{ inputs.dockerfile }}
build-args: |
VOLTO_VERSION=${{ inputs.volto-version }}
SUFFIX=${{ inputs.suffix }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
tags: ${{ inputs.image-name }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true,name=${{ inputs.image-name }}

- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"

- name: List digest directory
working-directory: ${{ runner.temp }}/digests
run: ls -la

- name: Upload digest
uses: actions/upload-artifact@v5
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
overwrite: true
retention-days: 1

merge:
runs-on: ubuntu-latest
environment: DOCKER_HUB
needs:
- release
steps:
- name: Download digests
uses: actions/download-artifact@v5
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
merge-multiple: true

- name: List digest directory
working-directory: ${{ runner.temp }}/digests
run: ls -la

- name: Login to Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.registry-username }}
password: ${{ secrets.registry-password }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ inputs.image-name }}
flavor: |
latest=false
suffix=${{ inputs.suffix }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=pep440,pattern={{version}},value=${{ inputs.volto-version }}
type=pep440,pattern={{major}}.{{minor}}.{{patch}},value=${{ inputs.volto-version }}
type=pep440,pattern={{major}}.{{minor}},value=${{ inputs.volto-version }}
type=pep440,pattern={{major}},value=${{ inputs.volto-version }}
type=sha
type=raw,value=latest,enable=${{ inputs.is-latest }}
type=raw,value=${{ inputs.volto-version }}

- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ inputs.image-name }}@sha256:%s ' *)

- name: Inspect image
run: |
docker buildx imagetools inspect ${{ inputs.image-name }}:${{ steps.meta.outputs.version }}
15 changes: 2 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

env:
BASE_IMAGE_NAME: plone/frontend
PLATFORMS: linux/amd64,linux/arm64
IS_LATEST: true

jobs:
Expand All @@ -17,18 +16,16 @@ jobs:
outputs:
BASE_IMAGE_NAME: ${{ steps.vars.outputs.BASE_IMAGE_NAME }}
IS_LATEST: ${{ steps.vars.outputs.IS_LATEST }}
PLATFORMS: ${{ steps.vars.outputs.PLATFORMS }}
VOLTO_VERSION: ${{ steps.vars.outputs.VOLTO_VERSION }}

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set BASE_IMAGE_NAME, IS_LATEST, PLATFORMS, VOLTO_VERSION
- name: Set BASE_IMAGE_NAME, IS_LATEST, VOLTO_VERSION
id: vars
run: |
echo "BASE_IMAGE_NAME=$BASE_IMAGE_NAME" >> $GITHUB_OUTPUT
echo "PLATFORMS=$PLATFORMS" >> $GITHUB_OUTPUT
echo "IS_LATEST=$IS_LATEST" >> $GITHUB_OUTPUT
echo "VOLTO_VERSION=$(cat version.txt)" >> $GITHUB_OUTPUT

Expand All @@ -41,7 +38,6 @@ jobs:
image-name: ${{ needs.meta.outputs.BASE_IMAGE_NAME }}-builder
context: ./pnpm
dockerfile: pnpm/Dockerfile.builder
platforms: ${{ needs.meta.outputs.PLATFORMS }}
is-latest: ${{ needs.meta.outputs.IS_LATEST == 'true' }}
secrets:
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -54,7 +50,6 @@ jobs:
image-name: ${{ needs.meta.outputs.BASE_IMAGE_NAME }}-prod-config
context: ./pnpm
dockerfile: pnpm/Dockerfile.prod
platforms: ${{ needs.meta.outputs.PLATFORMS }}
is-latest: ${{ needs.meta.outputs.IS_LATEST == 'true' }}

secrets:
Expand All @@ -70,7 +65,6 @@ jobs:
image-name: ${{ needs.meta.outputs.BASE_IMAGE_NAME }}-dev
context: ./pnpm
dockerfile: pnpm/Dockerfile.dev
platforms: ${{ needs.meta.outputs.PLATFORMS }}
is-latest: ${{ needs.meta.outputs.IS_LATEST == 'true' }}
secrets:
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -86,7 +80,6 @@ jobs:
image-name: plone/plone-frontend
context: ./pnpm
dockerfile: pnpm/Dockerfile
platforms: ${{ needs.meta.outputs.PLATFORMS }}
is-latest: ${{ needs.meta.outputs.IS_LATEST == 'true' }}
secrets:
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -105,7 +98,6 @@ jobs:
image-name: ${{ needs.meta.outputs.BASE_IMAGE_NAME }}-builder
context: ./yarn
dockerfile: yarn/Dockerfile.builder
platforms: ${{ needs.meta.outputs.PLATFORMS }}
suffix: -yarn
secrets:
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -118,7 +110,6 @@ jobs:
image-name: ${{ needs.meta.outputs.BASE_IMAGE_NAME }}-prod-config
context: ./yarn
dockerfile: yarn/Dockerfile.prod
platforms: ${{ needs.meta.outputs.PLATFORMS }}
suffix: -yarn
secrets:
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -133,7 +124,6 @@ jobs:
image-name: ${{ needs.meta.outputs.BASE_IMAGE_NAME }}-dev
context: ./yarn
dockerfile: yarn/Dockerfile.dev
platforms: ${{ needs.meta.outputs.PLATFORMS }}
suffix: -yarn
secrets:
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -149,7 +139,6 @@ jobs:
image-name: plone/plone-frontend
context: ./yarn
dockerfile: yarn/Dockerfile
platforms: ${{ needs.meta.outputs.PLATFORMS }}
suffix: -yarn
secrets:
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand Down
Loading