mirror of
https://github.com/ClaytonWWilson/miryoku_zmk.git
synced 2026-03-10 10:45:04 +00:00
Add build-with-inputs.yml
- Update docs
This commit is contained in:
123
.github/workflows/build-with-inputs.yml
vendored
Normal file
123
.github/workflows/build-with-inputs.yml
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
name: 'Build with inputs'
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
board:
|
||||
description: 'Board'
|
||||
required: true
|
||||
default: 'nice_nano'
|
||||
shield:
|
||||
description: 'Shield'
|
||||
required: false
|
||||
default: 'corne_left'
|
||||
alphas:
|
||||
description: 'Miryoku Alphas'
|
||||
required: false
|
||||
default: ''
|
||||
nav:
|
||||
description: 'Miryoku Nav'
|
||||
required: false
|
||||
default: ''
|
||||
clipboard:
|
||||
description: 'Miryoku Clipboard'
|
||||
required: false
|
||||
default: ''
|
||||
layers:
|
||||
description: 'Miryoku Layers'
|
||||
required: false
|
||||
default: ''
|
||||
mapping:
|
||||
description: 'Miryoku Mapping'
|
||||
required: false
|
||||
default: ''
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: zmkfirmware/zmk-build-arm:2.4
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Check inputs
|
||||
run: |
|
||||
echo "board: ${{ github.event.inputs.board }}"
|
||||
echo "shield: ${{ github.event.inputs.shield }}"
|
||||
echo "alphas: ${{ github.event.inputs.alphas }}"
|
||||
echo "nav: ${{ github.event.inputs.nav }}"
|
||||
echo "clipboard: ${{ github.event.inputs.clipboard }}"
|
||||
echo "layers: ${{ github.event.inputs.layers }}"
|
||||
echo "mapping: ${{ github.event.inputs.mapping }}"
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache west modules
|
||||
uses: actions/cache@v2
|
||||
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: Process variables
|
||||
id: variables
|
||||
run: |
|
||||
if [ -n "${{ github.event.inputs.shield }}" ]
|
||||
then
|
||||
SHIELD_ARG="-DSHIELD=${{ github.event.inputs.shield }}"
|
||||
fi
|
||||
echo "::set-output name=shield-arg::${SHIELD_ARG}"
|
||||
configfile="${GITHUB_WORKSPACE}/miryoku/config.h"
|
||||
echo '// https://github.com/manna-harbour/miryoku-zmk/' > "$configfile"
|
||||
echo "::set-output name=configfile::$configfile"
|
||||
artifact_build_name="miryoku_zmk ${{ github.event.inputs.shield }} ${{ github.event.inputs.board }}"
|
||||
for option in "alphas_${{ github.event.inputs.alphas }}" "nav_${{ github.event.inputs.nav }}" "clipboard_${{ github.event.inputs.clipboard }}" "layers_${{ github.event.inputs.layers }}" "mapping_${{ github.event.inputs.mapping }}"
|
||||
do
|
||||
case "$option" in
|
||||
*_ ) ;;
|
||||
* )
|
||||
artifact_build_name="$artifact_build_name $option"
|
||||
echo "#define MIRYOKU_"`echo "$option" | tr 'a-z' 'A-Z'` >> "$configfile"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
artifact_build_name=`echo $artifact_build_name | tr ' ' '-'`
|
||||
echo "::set-output name=artifact-build-name::$artifact_build_name"
|
||||
echo "::set-output name=artifact-generic-name::$artifact_build_name"
|
||||
echo "::set-output name=artifact-dir::artifacts"
|
||||
- name: Build (west build)
|
||||
run: west build -s zmk/app -b ${{ github.event.inputs.board }} -- ${{ steps.variables.outputs.shield-arg }} -DZMK_CONFIG="${GITHUB_WORKSPACE}/config"
|
||||
- name: Prepare artifacts
|
||||
run: |
|
||||
mkdir ${{ steps.variables.outputs.artifact-dir }}
|
||||
cp "${{ steps.variables.outputs.configfile }}" "${{ steps.variables.outputs.artifact-dir }}"
|
||||
for extension in "hex" "uf2"
|
||||
do
|
||||
file="build/zephyr/zmk.$extension"
|
||||
if [ -f "$file" ]
|
||||
then
|
||||
cp "$file" "${{ steps.variables.outputs.artifact-dir }}/${{ steps.variables.outputs.artifact-build-name }}.$extension"
|
||||
fi
|
||||
done
|
||||
- name: Archive artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ steps.variables.outputs.artifact-generic-name }}
|
||||
path: ${{ steps.variables.outputs.artifact-dir }}
|
||||
continue-on-error: true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user