west: Merge upstream ZMK #368
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |