From 7932903baf2230b971769e9da799f8d508cf9ce4 Mon Sep 17 00:00:00 2001 From: zhongfly <11155705+zhongfly@users.noreply.github.com> Date: Thu, 17 Feb 2022 03:44:27 +0800 Subject: [PATCH] Support to choose arch (#229) --- .github/workflows/magisk.yml | 38 ++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/.github/workflows/magisk.yml b/.github/workflows/magisk.yml index 3a836d3..6db7a12 100644 --- a/.github/workflows/magisk.yml +++ b/.github/workflows/magisk.yml @@ -4,6 +4,15 @@ on: pull_request: workflow_dispatch: inputs: + arch: + description: "Build arch" + required: true + default: "x64 & arm64" + type: choice + options: + - x64 + - arm64 + - x64 & arm64 magisk_apk: description: "Magisk version" required: true @@ -39,11 +48,36 @@ on: - none jobs: + matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Generate build matrix + id: set-matrix + uses: actions/github-script@v6 + with: + script: | + let matrix = {}; + let arch = "${{ github.event.inputs.arch }}" + switch ( arch ) { + case "x64": + matrix.arch = ["x64"]; + break; + case "arm64": + matrix.arch = ["arm64"]; + break; + default: + matrix.arch = ["x64", "arm64"]; + break; + } + core.setOutput("matrix",JSON.stringify(matrix)); + build: runs-on: ubuntu-20.04 + needs: matrix strategy: - matrix: - arch: [x64, arm64] + matrix: ${{fromJson(needs.matrix.outputs.matrix)}} steps: - name: Dependencies run: |