Skip to content

Commit 229fd9e

Browse files
Select models to build in the UI
1 parent c656292 commit 229fd9e

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

.github/workflows/NanoPi-Build.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,23 @@ on:
2424
openwrt_branch:
2525
description: 'OpenWrt Branch to build'
2626
required: true
27-
default: '21.02'
27+
default: '22.03'
2828
type: choice
2929
options:
3030
- '21.02'
3131
- '22.03'
32-
32+
model_R4S:
33+
description: 'Build R4S'
34+
type: boolean
35+
default: true
36+
model_R2S:
37+
description: 'Build R2S'
38+
type: boolean
39+
default: true
40+
model_R2C:
41+
description: 'Build R2C'
42+
type: boolean
43+
default: true
3344
jobs:
3445
init:
3546
runs-on: ubuntu-20.04
@@ -39,17 +50,26 @@ jobs:
3950
outputs:
4051
build_string: ${{ steps.gen_build_string.outputs.build_string }}
4152
release_tag: ${{ steps.gen_release_tag.outputs.release_tag }}
53+
matrix: ${{ steps.build_matrix.outputs.matrix }}
4254
steps:
4355
- id: gen_build_string
4456
run: echo "::set-output name=build_string::$(date +%Y.%m.%d)"
4557
- id: gen_release_tag
4658
run: echo "::set-output name=release_tag::$(date +%Y%m%d)"
59+
- id: build_matrix
60+
run: |
61+
model_R4S="${{ fromJSON('["", "R4S"]')[github.event.inputs.model_R4S == 'true'] }}"
62+
model_R2S="${{ fromJSON('["", "R2S"]')[github.event.inputs.model_R2S == 'true'] }}"
63+
model_R2C="${{ fromJSON('["", "R2C"]')[github.event.inputs.model_R2C == 'true'] }}"
64+
models="$model_R4S $model_R2S $model_R2C"
65+
modelsJson=$(echo -n "$models" | jq -R -s -c 'split(" ") | map(select(length>0))')
66+
matrix="{\"nanopi_model\":$modelsJson}"
67+
echo "::set-output name=matrix::$matrix"
4768
4869
build:
4970
needs: init
5071
strategy:
51-
matrix:
52-
nanopi_model: [R2S, R2C, R4S]
72+
matrix: ${{ fromJson(needs.init.outputs.matrix) }}
5373

5474
runs-on: ubuntu-20.04
5575
if: github.event.repository.owner.id == github.event.sender.id

0 commit comments

Comments
 (0)