Skip to content

Commit

Permalink
gh-actions: Initial commit of svalboard build workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
ilc committed Mar 17, 2024
1 parent c53c932 commit 4d184b3
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 102 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/build-firmware.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build QMK Firmware

on:
push:
tags:
- 'v*'

variables:
matrix: &matrix
keyboard: [svalboard/trackpoint]
keymap: [default]
side: [left, right]

jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/qmk/qmk_cli

strategy:
matrix: *matrix

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
submodules: 'recursive'

- name: Get tag version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- name: Build firmware
id: build_firmware
run: |
KEYBOARD_NAME="${{ matrix.keyboard }}"
KEYBOARD_NAME="${KEYBOARD_NAME//\//_}"
FILE_NAME="${KEYBOARD_NAME}_${{ matrix.side }}_${{ matrix.keymap }}_${{ steps.get_version.outputs.VERSION }}.uf2"
git config --global --add safe.directory '*'
qmk compile -kb ${{ matrix.keyboard }}/${{ matrix.side }} -km ${{ matrix.keymap }}
mv ${KEYBOARD_NAME}_${{ matrix.side }}_${{ matrix.keymap }}.uf2 "$FILE_NAME"
echo "::set-output name=file_name::$FILE_NAME"
shell: bash

- name: Upload firmware artifact
uses: actions/upload-artifact@v2
with:
name: firmware-${{ matrix.keyboard }}-${{ matrix.side }}
path: ${{ steps.build_firmware.outputs.file_name }}

release:
needs: build
runs-on: ubuntu-latest

strategy:
matrix: *matrix

steps:
- name: Download firmware artifacts
uses: actions/download-artifact@v2

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false

- name: Upload firmware to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./firmware-${{ matrix.keyboard }}-${{ matrix.side }}/${{ steps.build_firmware.outputs.file_name }}
asset_name: ${{ steps.build_firmware.outputs.file_name }}
asset_content_type: application/octet-stream

102 changes: 0 additions & 102 deletions .github/workflows/ci.yml

This file was deleted.

0 comments on commit 4d184b3

Please sign in to comment.