forked from artseyio/zmk-artsey
-
Notifications
You must be signed in to change notification settings - Fork 46
170 lines (167 loc) · 6.21 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Build
on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
container:
image: zmkfirmware/zmk-build-arm:stable
strategy:
fail-fast: false
matrix:
include:
- board: nice_nano
shield: corne_ardux_left
- board: nice_nano
shield: corne_ardux_right
- board: nice_nano
shield: the_paintbrush_left
- board: nice_nano
shield: the_paintbrush_right
- board: nice_nano_v2
shield: the_paintbrush_left
- board: nice_nano_v2
shield: the_paintbrush_right
- board: bluemicro840_v1
shield: the_paintbrush_left
- board: bluemicro840_v1
shield: the_paintbrush_right
- board: nrfmicro_13
shield: the_paintbrush_left
- board: nrfmicro_13
shield: the_paintbrush_right
- board: nrfmicro_11
shield: the_paintbrush_left
- board: nrfmicro_11
shield: the_paintbrush_right
- board: nice_nano
shield: artboard_left
- board: nice_nano
shield: artboard_right
- board: nice_nano
shield: corne_5_col_ardux_left
- board: nice_nano
shield: corne_5_col_ardux_right
- board: nice_nano
shield: corne_5_col_ardux_left_big
- board: nice_nano
shield: corne_5_col_ardux_right_big
- board: nice_nano_v2
shield: corne_5_col_ardux_left_big
- board: nice_nano_v2
shield: corne_5_col_ardux_right_big
- board: bluemicro840_v1
shield: bluehand_left
- board: bluemicro840_v1
shield: bluehand_right
- board: nice_nano
shield: tidbit_ardux_left
- board: nice_nano
shield: tidbit_ardux_right
- board: nice_nano_v2
shield: cradio_ardux_left
- board: nice_nano_v2
shield: cradio_ardux_thumb_left
- board: nice_nano_v2
shield: cradio_ardux_right
- board: nice_nano_v2
shield: cradio_ardux_thumb_right
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache west modules
uses: actions/cache@v4
env:
cache-name: cache-zephyr-modules
with:
path: |
bootloader/
modules/
tools/
zephyr/
zmk/
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('config/west.yml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
timeout-minutes: 2
continue-on-error: true
- name: Initialize workspace (west init)
run: west init -l config
- name: Update modules (west update)
run: west update
- name: Export Zephyr CMake package (west zephyr-export)
run: west zephyr-export
- name: Prepare variables
id: variables
run: |
if [ -n "${{ matrix.shield }}" ]; then
SHIELD_ARG="-DSHIELD=${{ matrix.shield }}"
ARTIFACT_NAME="${{ matrix.shield }}-${{ matrix.board }}-zmk-ardux"
else
SHIELD_ARG=
ARTIFACT_NAME="${{ matrix.board }}-zmk-ardux"
fi
echo shield-arg=${SHIELD_ARG} >>$GITHUB_OUTPUT
echo artifact-name=${ARTIFACT_NAME} >>$GITHUB_OUTPUT
- name: Build (west build)
run: west build -s zmk/app -b ${{ matrix.board }} -- ${{ steps.variables.outputs.shield-arg }} -DZMK_CONFIG="${GITHUB_WORKSPACE}/config"
- name: ARDUX implementation dtsi file
if: always()
run: cat -n config/ardux.dtsi
- name: Prep artifact (ardux.dtsi)
run: cp config/ardux.dtsi ./ardux.dtsi
- name: Prep artifact (${{ matrix.shield }}-${{ matrix.board }}-zmk-ardux.hex)
run: cp build/zephyr/zmk.hex ${{ matrix.shield }}-${{ matrix.board }}-zmk-ardux.hex
- name: Prep artifact (${{ matrix.shield }}-${{ matrix.board }}-zmk-ardux.uf2)
run: cp build/zephyr/zmk.uf2 ${{ matrix.shield }}-${{ matrix.board }}-zmk-ardux.uf2
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: '${{ steps.variables.outputs.artifact-name }}'
path: |
ardux.dtsi
${{ matrix.shield }}-${{ matrix.board }}.dts.pre.tmp
${{ matrix.shield }}-${{ matrix.board }}-zmk-ardux.hex
${{ matrix.shield }}-${{ matrix.board }}-zmk-ardux.uf2
continue-on-error: true
release:
runs-on: ubuntu-latest
name: Create Release
needs: build
steps:
- name: Get current date/time
id: date
run: echo "date=$(date +'%Y%m%d-%H%M')" >>$GITHUB_OUTPUT
- name: Generate release text
id: release_text
run: >
echo "release_text=$(echo '<b>Precompiled firmware files for ARDUX</b><br><br>
Download a firmware file by expanding "Assets", right clicking, and choosing "Save File As" or "Save Link As".
<br>${{ github.event.inputs.releaseBody }}
<br>Released on ${{ steps.date.outputs.date }}.
<br><br>${{ steps.docker_build.outputs.commits }}')" >>$GITHUB_OUTPUT
- name: Download build artifacts for release
uses: actions/download-artifact@v4
with:
path: release
- name: List files to include in release
if: always()
run: ls -R release/
- name: Create zip files directory for individual board assets
if: always()
run: mkdir zips
- name: Zip all firmware files for release
if: always()
run: cd release && for folder in ./*; do echo $folder; zip -r ../zips/${folder}.zip ${folder}/; done && cd ..
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: "zips/*"
allowUpdates: false
artifactErrorsFailBuild: true
commit: main
tag: ${{ steps.date.outputs.date }}
body: ${{ steps.release_text.outputs.release_text }}
name: ${{ steps.date.outputs.date }}
token: ${{ secrets.GITHUB_TOKEN }}