72 lines
2.6 KiB
YAML
72 lines
2.6 KiB
YAML
name: build
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- v*
|
|
pull_request:
|
|
release:
|
|
types: [published]
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Cache pip
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
- name: Cache PlatformIO
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.platformio
|
|
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.x'
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install wheel
|
|
pip install -U platformio
|
|
- name: Setup github_head_sha
|
|
run: echo "GITHUB_HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
- name: Set pr env
|
|
run: echo "PLATFORMIO_BUILD_FLAGS=-DBRANCH='\"${GITHUB_HEAD_REF}\"' -DVERSION='\"${GITHUB_HEAD_SHA::7}\"'" >> $GITHUB_ENV
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
- name: Set rel env
|
|
run: echo "PLATFORMIO_BUILD_FLAGS=-DVERSION='\"${GITHUB_REF#refs/*/}\"'" >> $GITHUB_ENV
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
- name: Run PlatformIO
|
|
run: pio run -e esp32 -e esp32c3 -e esp32c3-cdc -e esp32s3 -e esp32s3-cdc -e esp32-verbose -e esp32c3-verbose -e esp32s3-verbose -e m5stickc -e m5stickc-plus -e m5atom -e macchina-a0
|
|
- name: Rename firmware
|
|
run: |
|
|
cp .pio/build/esp32/firmware.bin esp32.bin
|
|
cp .pio/build/esp32c3/firmware.bin esp32c3.bin
|
|
cp .pio/build/esp32c3-cdc/firmware.bin esp32c3-cdc.bin
|
|
cp .pio/build/esp32s3/firmware.bin esp32s3.bin
|
|
cp .pio/build/esp32s3-cdc/firmware.bin esp32s3-cdc.bin
|
|
cp .pio/build/esp32-verbose/firmware.bin esp32-verbose.bin
|
|
cp .pio/build/esp32c3-verbose/firmware.bin esp32c3-verbose.bin
|
|
cp .pio/build/esp32s3-verbose/firmware.bin esp32s3-verbose.bin
|
|
cp .pio/build/m5stickc/firmware.bin m5stickc.bin
|
|
cp .pio/build/m5stickc-plus/firmware.bin m5stickc-plus.bin
|
|
cp .pio/build/m5atom/firmware.bin m5atom.bin
|
|
cp .pio/build/macchina-a0/firmware.bin macchina-a0.bin
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
with:
|
|
files: "*.bin"
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Archive Build
|
|
uses: kittaakos/upload-artifact-as-is@v0
|
|
with:
|
|
path: ./*.bin
|