Skip to content

update quickstart

update quickstart #14

Workflow file for this run

name: Build
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- environment: vehicle
name: heltec3-tracker
kind: esp32
- environment: vehicle_v4
name: heltec4-tracker
kind: esp32
- environment: ground_station
name: heltec3-groundstation
kind: esp32
- environment: ground_station_v4
name: heltec4-groundstation
kind: esp32
- environment: ground_wio
name: wio-eink-groundstation
kind: nrf52
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Cache PlatformIO
uses: actions/cache@v6
with:
path: |
~/.platformio
.pio
key: pio-${{ runner.os }}-${{ matrix.environment }}-${{ hashFiles('platformio.ini') }}
restore-keys: |
pio-${{ runner.os }}-${{ matrix.environment }}-
- name: Install PlatformIO
run: pip install platformio intelhex "esptool>=5"
- name: Build ${{ matrix.environment }}
run: pio run -e ${{ matrix.environment }}
# .bin is the app image (flash at 0x10000); .hex carries that offset in
# its records so hex-aware tools flash it to the right place.
# -factory.bin is the whole flash from 0x0 (bootloader + partition
# table + boot_app0 + app) — what the web flasher writes to blank boards
- name: Package firmware (ESP32)
if: matrix.kind == 'esp32'
run: |
mkdir -p artifacts
cp .pio/build/${{ matrix.environment }}/firmware.bin artifacts/${{ matrix.name }}.bin
python -c "from intelhex import IntelHex; ih = IntelHex(); ih.loadbin('.pio/build/${{ matrix.environment }}/firmware.bin', offset=0x10000); ih.write_hex_file('artifacts/${{ matrix.name }}.hex')"
python -m esptool --chip esp32s3 merge-bin -o artifacts/${{ matrix.name }}-factory.bin \
--flash-mode keep --flash-freq keep --flash-size 8MB \
0x0 .pio/build/${{ matrix.environment }}/bootloader.bin \
0x8000 .pio/build/${{ matrix.environment }}/partitions.bin \
0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin \
0x10000 .pio/build/${{ matrix.environment }}/firmware.bin
# nRF52 builds emit .hex natively and .uf2 via uf2_build.py; derive the
# raw .bin from the hex (starts at the app base above the SoftDevice)
- name: Package firmware (nRF52)
if: matrix.kind == 'nrf52'
run: |
mkdir -p artifacts
cp .pio/build/${{ matrix.environment }}/firmware.hex artifacts/${{ matrix.name }}.hex
cp .pio/build/${{ matrix.environment }}/firmware.uf2 artifacts/${{ matrix.name }}.uf2
python -c "from intelhex import IntelHex; IntelHex('.pio/build/${{ matrix.environment }}/firmware.hex').tobinfile('artifacts/${{ matrix.name }}.bin')"
# One artifact (zip) per target; releases re-attach the files individually
- name: Upload firmware
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.name }}
path: artifacts/
# Tag pushes (v*) publish the firmware as raw release assets — unlike CI
# artifacts, these download as plain .bin/.hex files, not zips
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download firmware
uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v3
with:
files: dist/*
prerelease: ${{ contains(github.ref_name, '-') }}
# Publishes the web flasher (flasher/) to GitHub Pages with firmware pulled
# from a GitHub release: the tag's release when triggered by a tag push, or
# the latest release when run manually via workflow_dispatch
pages:
if: always() && (needs.release.result == 'success' || github.event_name == 'workflow_dispatch')
needs: [release]
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v7
- name: Assemble site (flasher + release firmware)
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || '' }}
run: |
if [ -z "$TAG" ]; then
TAG=$(gh release view --json tagName -q .tagName)
fi
mkdir -p site/firmware
cp -r flasher/* site/
gh release download "$TAG" --pattern '*-factory.bin' --dir site/firmware
gh release download "$TAG" --pattern '*.uf2' --dir site/firmware
sed -i "s/\"version\": \"dev\"/\"version\": \"$TAG\"/" site/manifests/*.json
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v4
with:
path: site
- id: deployment
uses: actions/deploy-pages@v4