Skip to content
Merged
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
105 changes: 105 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,108 @@ jobs:
tag: ${{ github.ref_name }}
prerelease: true
make_latest: false

docker-build:
name: "Build Docker image for ${{ matrix.platform }}"
if: ${{ github.ref_type == 'tag' }}
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- platform: linux/amd64
runner: ubuntu-latest
arch_tag: amd64
cache_suffix: cache-amd64
- platform: linux/arm64
runner: ubuntu-22.04-arm
arch_tag: arm64
cache_suffix: cache-arm64
steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Docker metadata"
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ github.sha }},enable=true

- name: "Log in to GitHub Container Registry"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3
with:
install: true

- name: "Build and push ${{ matrix.platform }} image"
id: build
uses: docker/build-push-action@v6
with:
push: true
platforms: ${{ matrix.platform }}
tags: |
ghcr.io/${{ github.repository }}:${{ matrix.arch_tag }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ matrix.cache_suffix }}
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:${{ matrix.cache_suffix }},mode=max,platform=${{ matrix.platform }}
build-args: |
BUILDKIT_INLINE_CACHE=1

docker-manifest:
name: "Create and push multi-arch manifest"
if: ${{ github.ref_type == 'tag' }}
needs: docker-build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Docker metadata"
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ github.sha }},enable=true

- name: "Log in to GitHub Container Registry"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Create and push multi-arch manifest"
uses: int128/docker-manifest-create-action@v2.8.0
with:
tags: ${{ steps.meta.outputs.tags }}
sources: |
ghcr.io/${{ github.repository }}:amd64
ghcr.io/${{ github.repository }}:arm64