Skip to content

Add build action and new-style version info #3

Add build action and new-style version info

Add build action and new-style version info #3

Workflow file for this run

name: Compile Arduino files to hex
on:
push:
pull_request:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- label: "uno"
fqbn: "arduino:avr:uno"
build-dir: "arduino.avr.uno"
- label: "nano"
fqbn: "arduino:avr:nano"
build-dir: "arduino.avr.nano"
- label: "leonardo"
fqbn: "arduino:avr:leonardo"
build-dir: "arduino.avr.leonardo"
- label: "atmega328pb"
fqbn: "MiniCore:avr:328:variant=modelPB"
build-dir: "MiniCore.avr.328"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Print ref
run: echo ${{ github.ref }}
- name: Set VERSION
run: echo "VERSION=$(git describe --tags --always)" >> $GITHUB_ENV
- name: Set HEX_FILENAME
run: echo "HEX_FILENAME=dmcomm-original-${{ env.VERSION }}-${{ matrix.label }}.hex" >> $GITHUB_ENV
- name: Write build info
run: >
echo '#define DMCOMM_BUILD_INFO
F("name = dmcomm-original\r\nversion = ${{ env.VERSION }}\r\nboard = ${{ matrix.label }}")'
> dmcomm/dmcomm_build_info.h
- name: Compile sketch
uses: arduino/compile-sketches@v1
with:
fqbn: "${{ matrix.fqbn }}"
sketch-paths: |
- dmcomm
libraries:
cli-compile-flags: |
- --export-binaries
platforms: |
- name: "arduino:avr"
- name: "MiniCore:avr"
source-url: "https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json"
- name: Copy hex
run: cp dmcomm/build/${{ matrix.build-dir }}/dmcomm.ino.hex ${{ env.HEX_FILENAME }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.label }}
path: ${{ env.HEX_FILENAME }}
- name: Attach to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: ${{ env.HEX_FILENAME }}