From 3a13e5a387a8d3032c4ef4c5c0da35a403cacb80 Mon Sep 17 00:00:00 2001 From: zvecr Date: Thu, 12 Jan 2023 09:10:38 +0000 Subject: [PATCH] Add reusable workflow for qmk_keymap repo --- .github/workflows/qmk_keymap.yml | 80 ++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/qmk_keymap.yml diff --git a/.github/workflows/qmk_keymap.yml b/.github/workflows/qmk_keymap.yml new file mode 100644 index 00000000000..01be8593c5e --- /dev/null +++ b/.github/workflows/qmk_keymap.yml @@ -0,0 +1,80 @@ +name: Build qmk_keymap repo + +on: + workflow_call: + +permissions: + contents: write + +jobs: + prep: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + + steps: + - name: Checkout userspace + uses: actions/checkout@v3 + + - name: Configure build targets + id: set-matrix + run: | + data="" + delim="" + for file in *.json; do + data="${data}${delim}{\"file\":\"$file\"}" + delim="," + done + echo "matrix={\"include\":[$data]}" >> $GITHUB_OUTPUT + + build: + needs: prep + runs-on: ubuntu-latest + container: qmkfm/qmk_cli + + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.prep.outputs.matrix) }} + + steps: + - name: Checkout QMK + uses: actions/checkout@v3 + with: + repository: qmk/qmk_firmware + submodules: recursive + + - name: Checkout userspace + uses: actions/checkout@v3 + with: + path: users/${{ github.actor }} + + - name: Build firmware + run: qmk compile -j=4 "users/${{ github.actor }}/${{ matrix.file }}" + + - name: Archive firmware + uses: actions/upload-artifact@v3 + continue-on-error: true + with: + name: ${{ matrix.file }}_${{ github.actor }} + path: | + *.hex + *.bin + *.uf2 + + publish: + needs: build + runs-on: ubuntu-latest + + steps: + - uses: actions/download-artifact@v3 + + - uses: marvinpinto/action-automatic-releases@latest + if: always() + with: + repo_token: "${{ github.token }}" + automatic_release_tag: "latest" + title: "Latest Firmware" + files: | + **/*.hex + **/*.bin + **/*.uf2