2023-08-16 18:03:22 +02:00
|
|
|
name: PlatformIO CI
|
|
|
|
|
2023-09-13 16:18:34 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2024-05-15 20:49:26 +02:00
|
|
|
- dev
|
2023-08-16 18:03:22 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
2024-05-13 10:14:00 +02:00
|
|
|
outputs:
|
|
|
|
version: ${{ steps.version_step.outputs.version }}
|
2023-08-16 18:03:22 +02:00
|
|
|
steps:
|
2024-05-13 10:14:00 +02:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/cache@v4
|
2023-08-16 18:03:22 +02:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/pip
|
|
|
|
~/.platformio/.cache
|
|
|
|
key: ${{ runner.os }}-pio
|
|
|
|
- uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
|
|
|
- name: Install PlatformIO Core
|
|
|
|
run: pip install --upgrade platformio
|
|
|
|
- name: Build PlatformIO Project
|
|
|
|
run: pio run
|
2024-05-28 09:47:06 +02:00
|
|
|
- name: Archive built binaries
|
2024-05-13 10:14:00 +02:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-08-16 18:03:22 +02:00
|
|
|
with:
|
2024-05-28 09:47:06 +02:00
|
|
|
name: built-binaries-${{ github.sha }}
|
2023-09-13 16:18:34 +02:00
|
|
|
path: .pio/build/*/*.bin
|
2024-05-13 10:14:00 +02:00
|
|
|
if-no-files-found: error
|
2024-05-28 09:47:06 +02:00
|
|
|
- name: Archive bootapp binary
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: bootapp-binary-${{ github.sha }}
|
|
|
|
path: ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin
|
|
|
|
if-no-files-found: error
|
2024-05-13 10:14:00 +02:00
|
|
|
- name: Get version
|
|
|
|
id: version_step
|
|
|
|
run: echo "version=`cat src/version.h | grep CURRENT_VERSION | awk -F\\" '{print $2}'`" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
prerelease:
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
2024-05-15 20:49:26 +02:00
|
|
|
if: github.ref == 'refs/heads/dev'
|
2024-05-13 10:14:00 +02:00
|
|
|
steps:
|
2024-05-28 09:47:06 +02:00
|
|
|
- name: Download built binaries
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
with:
|
|
|
|
path: ${{ github.workspace }}/binaries
|
|
|
|
name: built-binaries-${{ github.sha }}
|
|
|
|
- name: Download bootapp binary
|
2024-05-13 10:14:00 +02:00
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
with:
|
|
|
|
path: ${{ github.workspace }}/binaries
|
2024-05-28 09:47:06 +02:00
|
|
|
name: bootapp-binary-${{ github.sha }}
|
|
|
|
- name: Rename built binaries
|
|
|
|
run: find ${{ github.workspace }}/binaries -mindepth 2 -maxdepth 3 -type f -name "*.bin" -exec sh -c 'cp "$0" "${{ github.workspace }}/binaries/$(basename $(dirname "$0"))_$(basename $0)"' {} \;
|
2024-05-13 10:14:00 +02:00
|
|
|
- name: Pre-release
|
|
|
|
uses: softprops/action-gh-release@v2
|
|
|
|
with:
|
|
|
|
name: nerdminer-prerelease-${{ needs.build.outputs.version }}
|
|
|
|
tag_name: nerdminer-prerelease-${{ needs.build.outputs.version }}
|
|
|
|
prerelease: true
|
|
|
|
fail_on_unmatched_files: true
|
|
|
|
files: ${{ github.workspace }}/binaries/*.bin
|
|
|
|
|