Publish #19
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: Publish | |
on: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
publish: | |
name: Publish | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: esp-rs/[email protected] | |
with: | |
default: true | |
buildtargets: esp32s3 | |
ldproxy: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
cache: 'pip' | |
cache-dependency-path: scripts/gen_esp32part.py # dummy as we only install a global package | |
- name: Install esptool | |
run: pip install esptool | |
- name: Enable caching | |
uses: Swatinem/rust-cache@v2 | |
- name: Build | |
run: cargo build --release | |
- name: Trim binary | |
run: esptool.py --chip esp32s3 elf2image --flash_size 4MB --output esp-pulser target/xtensa-esp32s3-espidf/release/esp-pulser | |
- name: Create merged binary for full flash | |
run: | | |
python scripts/gen_esp32part.py partitions.csv partition-table.bin | |
cp target/xtensa-esp32s3-espidf/release/bootloader.bin . | |
esptool.py --chip esp32s3 merge_bin -o esp-pulser-merged.bin --flash_mode dio --flash_size 4MB 0x1000 bootloader.bin 0x8000 partition-table.bin 0x10000 esp-pulser | |
- name: Get version from Cargo.toml | |
id: get_version | |
run: echo "VERSION=$(grep '^version =' Cargo.toml | sed -E 's/version = \"([^\"]+)\"/\1/')" >> $GITHUB_ENV | |
- name: Create Draft Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.VERSION }} | |
release_name: v${{ env.VERSION }} | |
draft: true | |
prerelease: false | |
- uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: esp-pulser | |
asset_name: esp-pulser | |
asset_content_type: application/x-dosexec | |
- uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: esp-pulser-merged.bin | |
asset_name: esp-pulser-merged.bin | |
asset_content_type: application/x-dosexec | |
- uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} |