Support to choose arch (#229)

This commit is contained in:
zhongfly 2022-02-17 03:44:27 +08:00 committed by GitHub
parent 80838a8be6
commit 7932903baf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,15 @@ on:
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
arch:
description: "Build arch"
required: true
default: "x64 & arm64"
type: choice
options:
- x64
- arm64
- x64 & arm64
magisk_apk: magisk_apk:
description: "Magisk version" description: "Magisk version"
required: true required: true
@ -39,11 +48,36 @@ on:
- none - none
jobs: 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: build:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: matrix
strategy: strategy:
matrix: matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
arch: [x64, arm64]
steps: steps:
- name: Dependencies - name: Dependencies
run: | run: |