@@ -14,10 +14,10 @@ permissions:
14
14
15
15
jobs :
16
16
prepare :
17
- name : Determine boards to build
17
+ name : Determine variants to build
18
18
runs-on : ubuntu-latest
19
19
outputs :
20
- boards : ${{ steps.select.outputs.boards }}
20
+ variants : ${{ steps.select.outputs.variants }}
21
21
steps :
22
22
- name : Checkout
23
23
uses : actions/checkout@v4
@@ -28,30 +28,30 @@ jobs:
28
28
run : sudo apt-get update && sudo apt-get install -y jq
29
29
30
30
- id : list
31
- name : Get all board list
31
+ name : Get all variant list
32
32
run : |
33
- echo "all_boards =$(python scripts/release.py --list-boards --json)" >> $GITHUB_OUTPUT
33
+ echo "all_variants =$(python scripts/release.py --list-boards --json)" >> $GITHUB_OUTPUT
34
34
35
35
- id : select
36
- name : Select boards based on changes
36
+ name : Select variants based on changes
37
37
env :
38
- ALL_BOARDS : ${{ steps.list.outputs.all_boards }}
38
+ ALL_VARIANTS : ${{ steps.list.outputs.all_variants }}
39
39
run : |
40
40
EVENT_NAME="${{ github.event_name }}"
41
41
42
- # For push to main branch, build all boards
42
+ # push 到 main 分支,编译全部变体
43
43
if [[ "$EVENT_NAME" == "push" ]]; then
44
- echo "boards=$ALL_BOARDS " >> $GITHUB_OUTPUT
44
+ echo "variants=$ALL_VARIANTS " >> $GITHUB_OUTPUT
45
45
exit 0
46
46
fi
47
47
48
- # For pull_request
48
+ # pull_request 场景
49
49
BASE_SHA="${{ github.event.pull_request.base.sha }}"
50
50
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
51
51
echo "Base: $BASE_SHA, Head: $HEAD_SHA"
52
52
53
53
CHANGED=$(git diff --name-only $BASE_SHA $HEAD_SHA || true)
54
- echo "Changed files:\n$CHANGED"
54
+ echo -e "Changed files:\n$CHANGED"
55
55
56
56
NEED_ALL=0
57
57
declare -A AFFECTED
@@ -67,40 +67,41 @@ jobs:
67
67
done <<< "$CHANGED"
68
68
69
69
if [[ "$NEED_ALL" -eq 1 ]]; then
70
- echo "boards=$ALL_BOARDS " >> $GITHUB_OUTPUT
70
+ echo "variants=$ALL_VARIANTS " >> $GITHUB_OUTPUT
71
71
else
72
72
if [[ ${#AFFECTED[@]} -eq 0 ]]; then
73
- echo "boards =[]" >> $GITHUB_OUTPUT
73
+ echo "variants =[]" >> $GITHUB_OUTPUT
74
74
else
75
- JSON=$(printf '%s\n' "${!AFFECTED[@]}" | sort -u | jq -R -s -c 'split("\n")[:-1]')
76
- echo "boards=$JSON" >> $GITHUB_OUTPUT
75
+ BOARDS_JSON=$(printf '%s\n' "${!AFFECTED[@]}" | sort -u | jq -R -s -c 'split("\n")[:-1]')
76
+ FILTERED=$(echo "$ALL_VARIANTS" | jq -c --argjson boards "$BOARDS_JSON" 'map(select(.board as $b | $boards | index($b)))')
77
+ echo "variants=$FILTERED" >> $GITHUB_OUTPUT
77
78
fi
78
79
fi
79
80
80
81
build :
81
- name : Build ${{ matrix.board }}
82
+ name : Build ${{ matrix.name }}
82
83
needs : prepare
83
- if : ${{ needs.prepare.outputs.boards != '[]' }}
84
+ if : ${{ needs.prepare.outputs.variants != '[]' }}
84
85
strategy :
85
- fail-fast : false # 单个 board 失败不影响其它 board
86
+ fail-fast : false # 单个变体失败不影响其它变体
86
87
matrix :
87
- board : ${{ fromJson(needs.prepare.outputs.boards ) }}
88
+ include : ${{ fromJson(needs.prepare.outputs.variants ) }}
88
89
runs-on : ubuntu-latest
89
90
container :
90
91
image : espressif/idf:release-v5.4
91
92
steps :
92
93
- name : Checkout
93
94
uses : actions/checkout@v4
94
95
95
- - name : Build current board
96
+ - name : Build current variant
96
97
shell : bash
97
98
run : |
98
99
source $IDF_PATH/export.sh
99
- python scripts/release.py ${{ matrix.board }}
100
+ python scripts/release.py ${{ matrix.board }} --name ${{ matrix.name }}
100
101
101
102
- name : Upload artifacts
102
103
uses : actions/upload-artifact@v4
103
104
with :
104
- name : xiaozhi_${{ matrix.board }}_${{ github.sha }}.bin
105
+ name : xiaozhi_${{ matrix.name }}_${{ github.sha }}.bin
105
106
path : build/merged-binary.bin
106
- if-no-files-found : error
107
+ if-no-files-found : error
0 commit comments