fix unité #928
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
name: Firmware Release | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Arduino CLI | |
uses: arduino/setup-arduino-cli@v1.1.1 | |
with: | |
version: 0.10.0 | |
- name: Install STM libs | |
run: | | |
arduino-cli config init --additional-urls https://github.com/stm32duino/BoardManagerFiles/raw/master/package_stmicroelectronics_index.json | |
arduino-cli config dump | |
arduino-cli core update-index | |
export STM32DUINO_VERSION="2.0.0" | |
arduino-cli core install STMicroelectronics:stm32@$STM32DUINO_VERSION | |
arduino-cli lib install LiquidCrystal@1.0.7 | |
arduino-cli lib install OneButton@1.5.0 | |
arduino-cli lib install CRC32@2.0.0 | |
- name: Get the version | |
id: version | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
run: | | |
echo ::set-output name=version::${GITHUB_REF/refs\/tags\//} | |
- name: Set VERSION variable | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && steps.version.outputs.version != '' | |
run: | | |
sed -Ei "s/#define VERSION \".+\"/#define VERSION \"${{ steps.version.outputs.version }}\"/" includes/parameters.h | |
- name: Build production HW3 | |
run: | | |
sed -Ei 's/#define MODE .+/#define MODE MODE_PROD/' includes/config.h | |
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output builds/respirator-production | |
mkdir -p dist/ | |
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h) | |
cp builds/respirator-production.bin "dist/respirator-production-HW3-$VERSION-$GITHUB_SHA.bin" | |
- name: Build production HW3 without mass flow meter | |
run: | | |
sed -Ei 's/#define MODE .+/#define MODE MODE_PROD/' includes/config.h | |
sed -Ei 's/#define MASS_FLOW_METER_ENABLED/\/\/ #define MASS_FLOW_METER_ENABLED/' includes/config.h | |
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output builds/respirator-production | |
mkdir -p dist/ | |
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h) | |
cp builds/respirator-production.bin "dist/respirator-production-HW3-NOMASSFLOWMETER-$VERSION-$GITHUB_SHA.bin" | |
- name: Archive binaries | |
uses: actions/upload-artifact@v1 | |
with: | |
name: bin | |
path: dist/ | |
- name: Release dev binaries | |
uses: softprops/action-gh-release@v1 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
with: | |
files: | | |
dist/*.bin | |
body: | | |
Auto-release (${{ github.sha }}) | |
⚠️ FOR TEST PURPOSE ONLY - DO NOT USE IN PRODUCTION | |
tag_name: auto-${{ github.run_id }} | |
prerelease: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release stable binaries | |
uses: softprops/action-gh-release@v1 | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && steps.version.outputs.version != '' | |
with: | |
files: | | |
dist/*.bin | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |