From f3264cd5e547ccd73718f580df3a4c43e3026d95 Mon Sep 17 00:00:00 2001 From: Matteo Gastaldello Date: Fri, 3 Apr 2026 15:32:32 +0200 Subject: [PATCH 1/2] refactor: simplify release workflows by removing matrix strategy and unnecessary steps --- .github/workflows/release-pullrequest.yaml | 36 +++----- .github/workflows/release-tag.yaml | 98 +++++----------------- 2 files changed, 33 insertions(+), 101 deletions(-) diff --git a/.github/workflows/release-pullrequest.yaml b/.github/workflows/release-pullrequest.yaml index dc17291..999932a 100644 --- a/.github/workflows/release-pullrequest.yaml +++ b/.github/workflows/release-pullrequest.yaml @@ -10,26 +10,15 @@ env: jobs: build: - name: Build and Push - strategy: - matrix: - runner: [buildjet-2vcpu-ubuntu-2204-arm, buildjet-2vcpu-ubuntu-2204] - include: - - runner: buildjet-2vcpu-ubuntu-2204-arm - platform: linux/arm64 - - runner: buildjet-2vcpu-ubuntu-2204 - platform: linux/amd64 - runs-on: ${{ matrix.runner }} + runs-on: ubuntu-latest permissions: contents: read packages: write steps: - - name: Prepare - run: | - platform=${{ matrix.platform }} - echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + - name: Checkout + uses: actions/checkout@v4 - name: Docker meta id: meta @@ -37,23 +26,24 @@ jobs: with: images: ${{ env.GHCR_REPO }} - - name: Login to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Build and NOT push - id: build + - name: Build (no push) uses: docker/build-push-action@v5 with: - platforms: ${{ matrix.platform }} push: false + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: | + CACHEBUST=${{ github.sha }} + COMMIT_HASH=${{ github.sha }} + cache-from: type=gha + cache-to: type=gha,mode=max test: runs-on: ubuntu-latest diff --git a/.github/workflows/release-tag.yaml b/.github/workflows/release-tag.yaml index 5163ee7..8893237 100644 --- a/.github/workflows/release-tag.yaml +++ b/.github/workflows/release-tag.yaml @@ -2,34 +2,23 @@ name: release-tag on: push: - tags: [ '[0-9]+.[0-9]+.[0-9]+', '[0-9]+.[0-9]+.[0-9]+-*' ] # Matches standard versions and pre-release suffixes + tags: [ '[0-9]+.[0-9]+.[0-9]+' ] env: GHCR_REPO: ghcr.io/${{ github.repository }} + DOCKER_PUSH: true jobs: - build: - name: Build and Push - strategy: - fail-fast: false - matrix: - runner: [buildjet-2vcpu-ubuntu-2204-arm, buildjet-2vcpu-ubuntu-2204] - include: - - runner: buildjet-2vcpu-ubuntu-2204-arm - platform: linux/arm64 - - runner: buildjet-2vcpu-ubuntu-2204 - platform: linux/amd64 - runs-on: ${{ matrix.runner }} - + build-and-push: + runs-on: ubuntu-latest + permissions: contents: read packages: write steps: - - name: Prepare - run: | - platform=${{ matrix.platform }} - echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + - name: Checkout + uses: actions/checkout@v4 - name: Docker meta id: meta @@ -38,78 +27,31 @@ jobs: images: ${{ env.GHCR_REPO }} - name: Login to GHCR + if: env.DOCKER_PUSH == 'true' uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Build and push by digest - id: build + - name: Build and push uses: docker/build-push-action@v5 with: - platforms: ${{ matrix.platform }} - push: true + push: ${{ env.DOCKER_PUSH == 'true' }} + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - outputs: type=image,"name=${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=true - - - name: Export digest - run: | - mkdir -p /tmp/digests - digest="${{ steps.build.outputs.digest }}" - touch "/tmp/digests/${digest#sha256:}" - - - name: Upload digest - uses: actions/upload-artifact@v4 - with: - name: digests-${{ env.PLATFORM_PAIR }} - path: /tmp/digests/* - if-no-files-found: error - retention-days: 1 - - merge: - runs-on: ubuntu-latest - needs: - - build - permissions: - contents: read - packages: write - steps: - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: /tmp/digests - pattern: digests-* - merge-multiple: true - - - name: Login to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.GHCR_REPO }} - - - name: Create manifest list and push - working-directory: /tmp/digests - run: | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf '${{ env.GHCR_REPO }}@sha256:%s ' *) - - - name: Inspect image - run: | - docker buildx imagetools inspect ${{ env.GHCR_REPO }}:${{ steps.meta.outputs.version }} + build-args: | + CACHEBUST=${{ github.sha }} + COMMIT_HASH=${{ github.sha }} + cache-from: type=gha + cache-to: type=gha,mode=max test: runs-on: ubuntu-latest From 59576163cc999c1e439706ea8acb45800723fcba Mon Sep 17 00:00:00 2001 From: Matteo Gastaldello Date: Fri, 3 Apr 2026 16:07:41 +0200 Subject: [PATCH 2/2] fix: update release workflows to support pre-release tags and improve local build handling --- .github/workflows/release-pullrequest.yaml | 9 ++++++--- .github/workflows/release-tag.yaml | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-pullrequest.yaml b/.github/workflows/release-pullrequest.yaml index 999932a..428bf0e 100644 --- a/.github/workflows/release-pullrequest.yaml +++ b/.github/workflows/release-pullrequest.yaml @@ -7,6 +7,7 @@ on: env: GHCR_REPO: ghcr.io/${{ github.repository }} + LOCAL_KIND: false jobs: build: @@ -36,14 +37,16 @@ jobs: uses: docker/build-push-action@v5 with: push: false - platforms: linux/amd64,linux/arm64 + load: ${{ env.LOCAL_KIND == 'true' }} + no-cache: ${{ env.LOCAL_KIND == 'true' }} + platforms: ${{ env.LOCAL_KIND == 'true' && 'linux/amd64' || 'linux/amd64,linux/arm64' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | CACHEBUST=${{ github.sha }} COMMIT_HASH=${{ github.sha }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: ${{ env.LOCAL_KIND == 'true' && '' || 'type=gha' }} + cache-to: ${{ env.LOCAL_KIND == 'true' && '' || 'type=gha,mode=max' }} test: runs-on: ubuntu-latest diff --git a/.github/workflows/release-tag.yaml b/.github/workflows/release-tag.yaml index 8893237..07ed365 100644 --- a/.github/workflows/release-tag.yaml +++ b/.github/workflows/release-tag.yaml @@ -2,11 +2,12 @@ name: release-tag on: push: - tags: [ '[0-9]+.[0-9]+.[0-9]+' ] + tags: [ '[0-9]+.[0-9]+.[0-9]+', '[0-9]+.[0-9]+.[0-9]+-*' ] # Matches standard versions and pre-release suffixes env: GHCR_REPO: ghcr.io/${{ github.repository }} DOCKER_PUSH: true + LOCAL_KIND: false jobs: build-and-push: @@ -44,14 +45,16 @@ jobs: uses: docker/build-push-action@v5 with: push: ${{ env.DOCKER_PUSH == 'true' }} - platforms: linux/amd64,linux/arm64 + load: ${{ env.LOCAL_KIND == 'true' }} + no-cache: ${{ env.LOCAL_KIND == 'true' }} + platforms: ${{ env.LOCAL_KIND == 'true' && 'linux/amd64' || 'linux/amd64,linux/arm64' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | CACHEBUST=${{ github.sha }} COMMIT_HASH=${{ github.sha }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: ${{ env.LOCAL_KIND == 'true' && '' || 'type=gha' }} + cache-to: ${{ env.LOCAL_KIND == 'true' && '' || 'type=gha,mode=max' }} test: runs-on: ubuntu-latest