* ci: build & release docker image * ci: sync docker-release workflow updates Squashes: - ci: use correct runs-on - ci: build images Co-Authored-By: Claude <noreply@anthropic.com> * Remove submodule checkout from docker-release.yml Removed submodule checkout step from Docker release workflow. * Simplify Docker release workflow by removing submodule checkout Removed submodule checkout step from Docker release workflow. --------- Co-authored-by: Claude <noreply@anthropic.com>
144 lines
4.1 KiB
YAML
144 lines
4.1 KiB
YAML
name: Docker Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*"
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
# Build amd64 image
|
|
build-amd64:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write
|
|
contents: read
|
|
outputs:
|
|
image-digest: ${{ steps.build.outputs.digest }}
|
|
image-metadata: ${{ steps.meta.outputs.json }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract 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=semver,pattern={{version}},suffix=-amd64
|
|
type=semver,pattern={{version}},suffix=-arm64
|
|
type=ref,event=branch,suffix=-amd64
|
|
type=ref,event=branch,suffix=-arm64
|
|
|
|
- name: Build and push amd64 image
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
provenance: false
|
|
push: true
|
|
|
|
# Build arm64 image
|
|
build-arm64:
|
|
runs-on: ubuntu-24.04-arm
|
|
permissions:
|
|
packages: write
|
|
contents: read
|
|
outputs:
|
|
image-digest: ${{ steps.build.outputs.digest }}
|
|
image-metadata: ${{ steps.meta.outputs.json }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract 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=semver,pattern={{version}},suffix=-amd64
|
|
type=semver,pattern={{version}},suffix=-arm64
|
|
type=ref,event=branch,suffix=-amd64
|
|
type=ref,event=branch,suffix=-arm64
|
|
|
|
- name: Build and push arm64 image
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/arm64
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
provenance: false
|
|
push: true
|
|
|
|
# Create multi-platform manifest
|
|
create-manifest:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write
|
|
contents: read
|
|
needs: [build-amd64, build-arm64]
|
|
steps:
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata for manifest
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=semver,pattern={{version}}
|
|
|
|
- name: Create and push manifest
|
|
run: |
|
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
${{ needs.build-amd64.outputs.image-digest }} \
|
|
${{ needs.build-arm64.outputs.image-digest }}
|
|
env:
|
|
DOCKER_METADATA_OUTPUT_JSON: ${{ steps.meta.outputs.json }}
|