name: Release
on:
push:
tags:
- '[0-9]*.[0-9]*.[0-9]*'
- 'v[0-9]*.[0-9]*.[0-9]*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
env:
PLATFORMIO_CORE_DIR: /mnt/TEMP/platformio/core
PIP_CACHE_DIR: /mnt/TEMP/platformio/pip-cache
steps:
- uses: actions/checkout@v4
with:
path: app
- uses: dtolnay/rust-toolchain@1.94.1
with:
components: llvm-tools-preview
targets: riscv32imc-unknown-none-elf,riscv32imafc-unknown-none-elf
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build tools
run: |
sudo mkdir -p /mnt/TEMP
sudo chown -R "$USER:$USER" /mnt/TEMP
python -m venv /mnt/TEMP/platformio/venv
/mnt/TEMP/platformio/venv/bin/pip install platformio==6.1.19
echo /mnt/TEMP/platformio/venv/bin >> "$GITHUB_PATH"
- name: Install ESP-IDF preview toolchain under /mnt/TEMP
run: |
sudo mkdir -p /mnt/TEMP
sudo chown -R "$USER:$USER" /mnt/TEMP
ci/install-esp-idf-s31.sh
working-directory: app
- name: Verify default ESP release features
run: |
python -c "from pathlib import Path; text = Path('platformio.ini').read_text(); assert 'custom_rust_features = esp32c3,wifi,bluetooth' in text; assert 'custom_rust_features = esp32s31,wifi,bluetooth' in text"
working-directory: app
- name: Build all release targets
run: pio run -e esp32-c3-devkitm-1 -e arduino -e esp32s31
working-directory: app
- name: Prepare release assets
run: |
cp .pio/build/esp32-c3-devkitm-1/firmware.elf dist/micro-rustscript-esp32-c3.elf
cp .pio/build/arduino/program dist/micro-rustscript-arduino
cp /mnt/TEMP/micro-rustscript-esp32s31/build/micro_rustscript_esp32s31.elf dist/micro-rustscript-esp32-s31.elf
cp .pio/generated/esp32-blinky.vmbc dist/esp32-blinky.vmbc
cp .pio/generated/rustscript.partition.bin dist/rustscript.partition.bin
cp scripts/flash_vmbc.py scripts/vmbc_image.py scripts/repl_vmbc.py partitions.csv dist/
cd dist
sha256sum micro-rustscript-esp32-c3.factory.bin micro-rustscript-esp32-c3.elf micro-rustscript-arduino micro-rustscript-esp32-s31.factory.bin micro-rustscript-esp32-s31.elf esp32-blinky.vmbc rustscript.partition.bin flash_vmbc.py vmbc_image.py repl_vmbc.py partitions.csv > SHA256SUMS
working-directory: app
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
name: micro-rustscript firmware ${{ github.ref_name }}
generate_release_notes: true
body: |
Release images for ESP32-C3-DevKitM-1, Arduino host, and ESP32-S31. Both ESP factory images enable the ESP-IDF Wi-Fi and Bluetooth LE controller APIs by default.
Flash at offset `0x0`:
```bash
python -m esptool --chip esp32c3 erase_flash
python -m esptool --chip esp32c3 write_flash 0x0 micro-rustscript-esp32-c3.factory.bin
python -m esptool --chip esp32s31 write_flash 0x0 micro-rustscript-esp32-s31.factory.bin
```
files: |
app/dist/micro-rustscript-esp32-c3.factory.bin
app/dist/micro-rustscript-esp32-c3.elf
app/dist/micro-rustscript-arduino
app/dist/micro-rustscript-esp32-s31.factory.bin
app/dist/micro-rustscript-esp32-s31.elf
app/dist/esp32-blinky.vmbc
app/dist/rustscript.partition.bin
app/dist/flash_vmbc.py
app/dist/vmbc_image.py
app/dist/repl_vmbc.py
app/dist/partitions.csv
app/dist/SHA256SUMS