Build and publish Vial firmware #4
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
# Largely based on QMK's builtin workflow but tailored for my usage with Vial | |
name: Build and publish Vial firmware | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- keyboards/** | |
- vial-qmk/** | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: qmkfm/base_container | |
steps: | |
- name: Checkout Userspace | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ github.token }} | |
submodules: recursive | |
- name: Install QMK CLI | |
run: | | |
python3 -m pip install --upgrade qmk | |
python3 -m pip install -r vial-qmk/requirements.txt | |
- name: Configure QMK CLI | |
run: | | |
qmk config userspace_compile.parallel=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null) | |
qmk config user.qmk_home=$GITHUB_WORKSPACE/vial-qmk | |
qmk config user.overlay_dir=$GITHUB_WORKSPACE | |
- name: Validate userspace | |
run: | | |
qmk userspace-doctor | |
- name: Build | |
run: | | |
qmk userspace-compile -e DUMP_CI_METADATA=yes || touch .failed | |
# Generate the step summary markdown | |
./qmk_firmware/util/ci/generate_failure_markdown.sh > $GITHUB_STEP_SUMMARY || true | |
# Truncate to a maximum of 1MB to deal with GitHub workflow limit | |
truncate --size='<960K' $GITHUB_STEP_SUMMARY || true | |
# Exit with failure if the compilation stage failed | |
[ ! -f .failed ] || exit 1 | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
if: always() && !cancelled() | |
continue-on-error: true | |
with: | |
name: firmware | |
path: | | |
*.bin | |
*.hex | |
*.uf2 | |
publish: | |
if: always() && !cancelled() | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download binaries | |
uses: actions/download-artifact@v4 | |
with: | |
name: firmware | |
path: assets | |
- name: Create a new GitHub release | |
run: | | |
gh release create "$(TZ=Asia/Tokyo date --iso-8601=seconds)" assets/* \ | |
--generate-notes | |
env: | |
GH_TOKEN: ${{ github.token }} |