From 48a4977208cb032c606de750367f5d0f67ad519b Mon Sep 17 00:00:00 2001 From: mii443 Date: Sun, 25 May 2025 22:50:11 +0900 Subject: [PATCH] update gh action --- .github/workflows/build.yml | 43 +++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 688637f..f1a2125 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,9 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + platform: [linux/amd64, linux/arm64] steps: - uses: actions/checkout@v4 name: Checkout @@ -25,12 +28,44 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Extract platform for tagging + id: platform + run: | + platform_clean=$(echo "${{ matrix.platform }}" | tr '/' '-') + echo "clean=${platform_clean}" >> $GITHUB_OUTPUT + - uses: docker/build-push-action@v4 with: context: . push: true - platforms: linux/amd64,linux/arm64 - tags: ${{ steps.meta.outputs.tags }} + platforms: ${{ matrix.platform }} + tags: ${{ steps.meta.outputs.tags }}-${{ steps.platform.outputs.clean }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=${{ steps.platform.outputs.clean }} + cache-to: type=gha,mode=max,scope=${{ steps.platform.outputs.clean }} + + create-manifest: + runs-on: ubuntu-latest + needs: build + steps: + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: mii443 + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/metadata-action@v4 + id: meta + with: + images: ghcr.io/mii443/ncb-tts-r2 + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Create and push manifest + run: | + for tag in ${{ steps.meta.outputs.tags }}; do + docker manifest create $tag \ + ${tag}-linux-amd64 \ + ${tag}-linux-arm64 + docker manifest push $tag + done