From 0ecbbced96d4c15cbf0081b7d05a39153e9cd34e Mon Sep 17 00:00:00 2001 From: YuCat-OVO <66810215+YuCat-OVO@users.noreply.github.com> Date: Sat, 2 Mar 2024 03:08:31 +0800 Subject: [PATCH] arch --- .github/workflows/build.yml | 50 ++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c38dcbf..271602b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: name: Build strategy: matrix: - arch: [linux/amd64, linux/arm64] + arch: [amd64, arm64] runs-on: ubuntu-latest steps: - name: Checkout @@ -28,11 +28,11 @@ jobs: id: set-vars run: | VERSION="1.0.1" - if [ ${{ matrix.arch }} == linux/amd64 ]; then + if [ ${{ matrix.arch }} == amd64 ]; then BAIDUNETDISK_VERSION=$(jq -r '.[1] | "\(.version)"' info.json); BAIDUNETDISK_URL=$(jq -r '.[1] | "\(.url)"' info.json); fi - if [ ${{ matrix.arch }} == linux/arm64 ]; then + if [ ${{ matrix.arch }} == arm64 ]; then BAIDUNETDISK_VERSION=$(jq -r '.[2] | "\(.version)"' info.json); BAIDUNETDISK_URL=$(jq -r '.[2] | "\(.url)"' info.json); fi @@ -47,8 +47,9 @@ jobs: echo "BRACH=${BRACH}" >> $GITHUB_OUTPUT echo "DATE=${DATE}" >> $GITHUB_OUTPUT - - name: Docker Meta - id: meta + - name: Docker Meta (amd64) + id: meta-amd + if: ${{ matrix.arch }} == amd64 uses: docker/metadata-action@v5 with: images: | @@ -59,6 +60,19 @@ jobs: type=raw,value=${{ steps.set-vars.outputs.BRACH }} type=raw,value=latest + - name: Docker Meta (arm64) + id: meta-arm + if: ${{ matrix.arch }} == arm64 + uses: docker/metadata-action@v5 + with: + images: | + ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }} + ghcr.io/${{ github.repository }} + tags: | + type=raw,value=arm64-${{ steps.set-vars.outputs.VERSION }} + type=raw,value=arm64-${{ steps.set-vars.outputs.BRACH }} + type=raw,value=arm64-latest + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -78,18 +92,36 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Buildx + - name: Buildx (amd64) + if: ${{ matrix.arch }} == amd64 uses: docker/build-push-action@v5 with: context: . file: Dockerfile platforms: | - ${{ matrix.arch }} + linux/amd64 push: true build-args: | BUILD_DATE=${{ steps.set-vars.outputs.DATE }} VERSION=${{ steps.set-vars.outputs.VERSION }} BAIDUNETDISK_VERSION=${{ steps.set-vars.outputs.BAIDUNETDISK_VERSION }} BAIDUNETDISK_URL=${{ steps.set-vars.outputs.BAIDUNETDISK_URL }} - labels: ${{ steps.meta.outputs.labels }} - tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta-amd.outputs.labels }} + tags: ${{ steps.meta-amd.outputs.tags }} + + - name: Buildx (arm64) + if: ${{ matrix.arch }} == arm64 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + platforms: | + linux/arm64 + push: true + build-args: | + BUILD_DATE=${{ steps.set-vars.outputs.DATE }} + VERSION=${{ steps.set-vars.outputs.VERSION }} + BAIDUNETDISK_VERSION=${{ steps.set-vars.outputs.BAIDUNETDISK_VERSION }} + BAIDUNETDISK_URL=${{ steps.set-vars.outputs.BAIDUNETDISK_URL }} + labels: ${{ steps.meta-arm.outputs.labels }} + tags: ${{ steps.meta-arm.outputs.tags }}