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: Build and Release AirSense Firmware | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
paths: | |
- airsense_firmware/** | |
- platformio.ini | |
- .github/workflows/build_release.yml | |
pull_request: | |
branches: | |
- main | |
paths: | |
- airsense_firmware/** | |
- platformio.ini | |
- .github/workflows/build_release.yml | |
permissions: | |
contents: write | |
jobs: | |
lint_airsense_firmware: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Install PlatformIO core | |
run: pip install -U platformio | |
- name: Check code quality | |
run: pio check | |
- name: Build Firmware | |
run: | | |
set -x | |
pio run | |
# pio ci --project-conf platformio.ini . | |
build_airsense_firmware: | |
runs-on: ubuntu-latest | |
needs: | |
- lint_airsense_firmware | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Install PlatformIO core | |
run: pip install -U platformio | |
- name: Check code quality | |
run: pio check | |
- name: Build Firmware | |
run: | | |
set -x | |
pio run | |
# pio ci --project-conf platformio.ini . | |
- name: List all files | |
if: always() | |
continue-on-error: true | |
run: | | |
set -x | |
pwd | |
ls -allh | |
tree | |
# TODO: Validate | |
- name: Upload firmware | |
uses: actions/upload-artifact@v4 | |
with: | |
path: .pio/build/esp32dev/firmware.bin | |
name: airsense_firmware.bin | |
compression-level: 0 | |
if-no-files-found: error | |
create_release: | |
runs-on: ubuntu-latest | |
environment: github_release | |
needs: | |
- build_airsense_firmware | |
# if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
steps: | |
- id: version | |
name: Get Version | |
run: | | |
set -x | |
if [[ "${{ github.ref_type }}" == "tag" ]]; then | |
version=${{ github.ref_name }} | |
else | |
version="${GITHUB_SHA::7}" | |
fi | |
echo "version=${version}" > $GITHUB_OUTPUT | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: List all files | |
if: always() | |
continue-on-error: true | |
run: | | |
set -x | |
pwd | |
ls -all | |
tree | |
- name: Create Release ${{ steps.version.outputs.version }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: Release ${{ steps.version.outputs.version }} | |
tag_name: ${{ steps.version.outputs.version }} | |
generate_release_notes: true | |
files: | | |
*.bin |