58 lines
1.4 KiB
YAML
58 lines
1.4 KiB
YAML
name: OTA build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-ota:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 45
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install PlatformIO
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install platformio
|
|
|
|
- name: Build OTA firmware binaries
|
|
run: pio run
|
|
|
|
- name: Prepare direct OTA files
|
|
run: |
|
|
set -eu
|
|
rm -rf dist/ota
|
|
project_name="${GITHUB_REPOSITORY#*/}"
|
|
project_name="${project_name#PlatformIO_}"
|
|
timestamp="$(date -u +%Y-%m-%dT%H-%M-%SZ)"
|
|
mkdir -p dist/ota
|
|
found=0
|
|
for fw in .pio/build/*/firmware.bin; do
|
|
[ -f "$fw" ] || continue
|
|
env_name="$(basename "$(dirname "$fw")")"
|
|
cp "$fw" "dist/ota/${project_name}_${env_name}_${timestamp}.bin"
|
|
found=1
|
|
done
|
|
if [ "$found" -eq 0 ]; then
|
|
echo 'No firmware.bin artifacts were produced.' >&2
|
|
exit 1
|
|
fi
|
|
find dist/ota -maxdepth 1 -type f | sort
|
|
|
|
- name: Upload direct OTA files
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: ota-files
|
|
path: dist/ota/*
|
|
if-no-files-found: error
|
|
archive: false
|