mirror of
https://github.com/CloudNebulaProject/barycenter.git
synced 2026-04-10 13:10:42 +00:00
feat: use native ARM64 runners with matrix strategy for faster builds
This commit is contained in:
parent
876c659292
commit
609f39813f
1 changed files with 55 additions and 7 deletions
62
.github/workflows/release.yml
vendored
62
.github/workflows/release.yml
vendored
|
|
@ -10,12 +10,19 @@ env:
|
|||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
build-platform:
|
||||
runs-on: ${{ matrix.runner }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
id-token: write
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- platform: linux/amd64
|
||||
runner: ubuntu-latest
|
||||
- platform: linux/arm64
|
||||
runner: ubuntu-24.04-arm64
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
|
|
@ -45,18 +52,20 @@ jobs:
|
|||
org.opencontainers.image.title=Barycenter
|
||||
org.opencontainers.image.description=OpenID Connect Identity Provider with federation and auto-registration
|
||||
org.opencontainers.image.vendor=${{ github.repository_owner }}
|
||||
flavor: |
|
||||
suffix=-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
- name: Build and push platform-specific image
|
||||
id: build
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: ${{ matrix.platform }}
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
cache-from: type=gha,scope=${{ matrix.platform }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
|
||||
build-args: |
|
||||
VERSION=${{ github.ref_name }}
|
||||
REVISION=${{ github.sha }}
|
||||
|
|
@ -68,9 +77,48 @@ jobs:
|
|||
subject-digest: ${{ steps.build.outputs.digest }}
|
||||
push-to-registry: true
|
||||
|
||||
create-manifest:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-platform
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
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=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}},enable=${{ !contains(github.ref_name, 'alpha') && !contains(github.ref_name, 'beta') && !contains(github.ref_name, 'rc') }}
|
||||
type=semver,pattern={{major}},enable=${{ !contains(github.ref_name, 'alpha') && !contains(github.ref_name, 'beta') && !contains(github.ref_name, 'rc') }}
|
||||
type=sha,prefix=sha-
|
||||
|
||||
- name: Create and push multi-platform manifest
|
||||
run: |
|
||||
# Extract tags into an array
|
||||
TAGS=$(echo '${{ steps.meta.outputs.tags }}' | tr '\n' ' ')
|
||||
|
||||
# For each tag, create a manifest combining both platform images
|
||||
for TAG in $TAGS; do
|
||||
echo "Creating manifest for $TAG"
|
||||
docker buildx imagetools create -t $TAG \
|
||||
${TAG}-amd64 \
|
||||
${TAG}-arm64
|
||||
done
|
||||
|
||||
create-github-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-and-push
|
||||
needs: create-manifest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue