-
Notifications
You must be signed in to change notification settings - Fork 134
120 lines (103 loc) · 3.53 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
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container:
image: zmkfirmware/zmk-build-arm:stable
strategy:
matrix:
include:
- { board: [email protected], keymap: hw75_keyboard.keymap }
- { board: [email protected], keymap: hw75_keyboard.keymap }
- { board: hw75_dynamic@A, keymap: hw75_dynamic.keymap }
- { board: hw75_dynamic@B, keymap: hw75_dynamic.keymap }
steps:
- name: Prepare variables
run: |
echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Set up build tools
run: |
apt-get update
apt-get install -y python3-pip protobuf-compiler curl
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get install -y nodejs
pip install -U fonttools
npm install -g lv_font_conv
- name: Cache west modules
uses: actions/[email protected]
continue-on-error: true
env:
cache_name: cache-zephyr-${{ env.zephyr_version }}-modules
with:
path: |
modules/
zephyr/
zmk/
key: ${{ runner.os }}-build-${{ env.cache_name }}-${{ hashFiles('**/west.yml', '**/build.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache_name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Prepare west
run: |
west init -l config
west update
west zephyr-export
pip install -r zephyr/scripts/requirements.txt
git config --global --add safe.directory $PWD
- name: West build
run: |
west build -s zmk/app -b ${{ matrix.board }} -- \
-DZMK_CONFIG=${GITHUB_WORKSPACE}/config \
-DKEYMAP_FILE=${GITHUB_WORKSPACE}/config/${{ matrix.keymap }}
env:
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python
- name: Rename artifacts
run: |
mkdir build/artifacts
if [ -f build/zephyr/zmk.uf2 ]; then
cp build/zephyr/zmk.uf2 "build/artifacts/${{ matrix.board }}-zmk.uf2"
fi
if [ -f build/zephyr/zmk.hex ]; then
cp build/zephyr/zmk.hex "build/artifacts/${{ matrix.board }}-zmk.hex"
fi
cp build/zephyr/zmk.bin "build/artifacts/${{ matrix.board }}-zmk.bin"
- name: Archive
uses: actions/upload-artifact@v3
with:
name: firmware
path: build/artifacts
release:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: firmware
path: firmware
- name: Prepare release notes
id: release
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "RELEASE_BODY<<$EOF" >> $GITHUB_OUTPUT
sed 's/{{TAG}}/${{ github.ref_name }}/g' .github/RELEASE_TEMPLATE.md >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Publish release
uses: svenstaro/upload-release-action@v2
with:
file: firmware/*
file_glob: true
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
body: |
${{ steps.release.outputs.RELEASE_BODY }}
prerelease: true