Skip to content
Merged
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
39 changes: 16 additions & 23 deletions .github/workflows/release-pullrequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,46 @@ on:

env:
GHCR_REPO: ghcr.io/${{ github.repository }}
LOCAL_KIND: false

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
uses: docker/metadata-action@v5
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
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: ${{ env.LOCAL_KIND == 'true' && '' || 'type=gha' }}
cache-to: ${{ env.LOCAL_KIND == 'true' && '' || 'type=gha,mode=max' }}

test:
runs-on: ubuntu-latest
Expand Down
99 changes: 22 additions & 77 deletions .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,20 @@ on:

env:
GHCR_REPO: ghcr.io/${{ github.repository }}
DOCKER_PUSH: true
LOCAL_KIND: false

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
Expand All @@ -38,78 +28,33 @@ 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' }}
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 }}
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: ${{ env.LOCAL_KIND == 'true' && '' || 'type=gha' }}
cache-to: ${{ env.LOCAL_KIND == 'true' && '' || 'type=gha,mode=max' }}

test:
runs-on: ubuntu-latest
Expand Down
Loading