ci: Attach firmware hex and bin to GitHub releases.#284
Conversation
There was a problem hiding this comment.
Pull request overview
Adds firmware artifacts to GitHub Releases by extending the semantic-release workflow to build MicroPython firmware with frozen drivers and upload the resulting .hex and .bin files when a new release is published.
Changes:
- Emit GitHub Actions outputs (
new-release-published,new-release-version) from semantic-release via@semantic-release/exec. - Add a
firmwarejob to the release workflow that checks out the release tag, builds firmware, and uploads assets to the GitHub release.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.releaserc.json |
Adds publishCmd to write release-related outputs for downstream workflow jobs. |
.github/workflows/release.yml |
Exposes release job outputs and introduces a firmware build + upload job gated on a new release. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Clone MicroPython | ||
| run: | | ||
| git clone --branch $MICROPYTHON_BRANCH $MICROPYTHON_REPO .build/micropython-steami | ||
| cd .build/micropython-steami/ports/stm32 && make BOARD=$BOARD submodules | ||
|
|
||
| - name: Build firmware | ||
| run: | | ||
| rm -rf .build/micropython-steami/lib/micropython-steami-lib | ||
| ln -s $GITHUB_WORKSPACE .build/micropython-steami/lib/micropython-steami-lib | ||
| cd .build/micropython-steami/ports/stm32 && make BOARD=$BOARD |
There was a problem hiding this comment.
The firmware build logic here duplicates the repository’s make firmware flow (clone, submodules, symlink, build). This duplication is likely to drift from the documented/maintained process over time; consider calling make firmware (with the appropriate env vars) instead of re-encoding the steps in the workflow.
| - name: Clone MicroPython | |
| run: | | |
| git clone --branch $MICROPYTHON_BRANCH $MICROPYTHON_REPO .build/micropython-steami | |
| cd .build/micropython-steami/ports/stm32 && make BOARD=$BOARD submodules | |
| - name: Build firmware | |
| run: | | |
| rm -rf .build/micropython-steami/lib/micropython-steami-lib | |
| ln -s $GITHUB_WORKSPACE .build/micropython-steami/lib/micropython-steami-lib | |
| cd .build/micropython-steami/ports/stm32 && make BOARD=$BOARD | |
| - name: Build firmware | |
| run: | | |
| make firmware |
| ["@semantic-release/exec", { | ||
| "prepareCmd": "sed -i 's/^version = \".*\"/version = \"${nextRelease.version}\"/' pyproject.toml" | ||
| "prepareCmd": "sed -i 's/^version = \".*\"/version = \"${nextRelease.version}\"/' pyproject.toml", | ||
| "publishCmd": "echo new-release-published=true >> $GITHUB_OUTPUT && echo new-release-version=${nextRelease.version} >> $GITHUB_OUTPUT" |
There was a problem hiding this comment.
publishCmd assumes $GITHUB_OUTPUT is set; running semantic-release outside GitHub Actions (e.g., local dry-runs) will fail due to an empty/undefined redirect target. Guard this write (only append when $GITHUB_OUTPUT is non-empty) and quote the path to avoid shell parsing issues.
| "publishCmd": "echo new-release-published=true >> $GITHUB_OUTPUT && echo new-release-version=${nextRelease.version} >> $GITHUB_OUTPUT" | |
| "publishCmd": "[ -n \"${GITHUB_OUTPUT:-}\" ] && { echo 'new-release-published=true' >>\"$GITHUB_OUTPUT\"; echo \"new-release-version=${nextRelease.version}\" >>\"$GITHUB_OUTPUT\"; }" |
| sudo apt-get install -y --no-install-recommends gcc-arm-none-eabi libnewlib-arm-none-eabi | ||
|
|
||
| - name: Clone MicroPython | ||
| run: | |
There was a problem hiding this comment.
git clone ... .build/micropython-steami will fail if the parent .build/ directory doesn’t exist (it’s gitignored), which would break the firmware job on a fresh runner. Create the directory first (e.g., mkdir -p .build) or use the existing Makefile target that already ensures this.
| run: | | |
| run: | | |
| mkdir -p .build |
c71bca6 to
c91ba59
Compare
c91ba59 to
56f28f9
Compare
|
Commentaires Copilot traités dans 9f7e783 :
Aussi corrigé un mismatch de nommage : les |
Summary
Add a
firmwarejob to the release workflow that builds MicroPython firmware with frozen drivers and attaches both.hexand.binfiles to each GitHub release.How it works
@semantic-release/execpublishCmdwritesnew-release-publishedandnew-release-versionto$GITHUB_OUTPUTif: needs.release.outputs.new-release-published == 'true')steami-firmware-vX.Y.Z.hexandsteami-firmware-vX.Y.Z.binto the GitHub releaseFiles changed
.github/workflows/release.yml: addedoutputson release job, addedfirmwarejob.releaserc.json: addedpublishCmdto@semantic-release/execfor GitHub Actions outputsCloses #283
Test plan