From ba29b9435b3bbbe03a52b5ceab42dd295eae899a Mon Sep 17 00:00:00 2001 From: YuCat-OVO <66810215+YuCat-OVO@users.noreply.github.com> Date: Sat, 2 Mar 2024 02:40:20 +0800 Subject: [PATCH] matrix --- .github/workflows/build.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c04ee27..5afbaa9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,23 +11,37 @@ on: - "README.md" - "get_version.py" -env: - IMAGE_NAME: BaiduNetdisk-Docker +env: + IMAGE_NAME: BaiduNetdisk-Docker jobs: - Build: - name: Build + Setup: + name: Setup runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@master + Build: + name: Build + needs: Setup + strategy: + matrix: + arch: [linux/amd64, linux/arm64] + runs-on: ubuntu-latest + steps: - name: Set variables id: set-vars run: | VERSION="1.0.1" - BAIDUNETDISK_VERSION=$(jq -r '.[1] | "\(.arch)"' info.json) - BAIDUNETDISK_URL=$(jq -r '.[1] | "\(.url)"' info.json) + if [ ${{ matrix.arch }} == linux/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 + BAIDUNETDISK_VERSION=$(jq -r '.[2] | "\(.version)"' info.json); + BAIDUNETDISK_URL=$(jq -r '.[2] | "\(.url)"' info.json); + fi GITHUB_REF=${{ github.ref }} BRACH=${GITHUB_REF#refs/heads/} DATE=$(date '+%Y-%m-%dT%H:%M:%S%Z') @@ -76,7 +90,7 @@ jobs: context: . file: Dockerfile platforms: | - linux/amd64 + ${{ matrix.arch }} push: true build-args: | BUILD_DATE=${{ steps.set-vars.outputs.DATE }}