Skip to content

ci: Attach firmware hex and bin to GitHub releases.#284

Merged
nedseb merged 2 commits into
mainfrom
ci/firmware-release-asset
Mar 28, 2026
Merged

ci: Attach firmware hex and bin to GitHub releases.#284
nedseb merged 2 commits into
mainfrom
ci/firmware-release-asset

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Mar 28, 2026

Summary

Add a firmware job to the release workflow that builds MicroPython firmware with frozen drivers and attaches both .hex and .bin files to each GitHub release.

How it works

  1. Semantic release runs and creates a new release (if commits warrant it)
  2. @semantic-release/exec publishCmd writes new-release-published and new-release-version to $GITHUB_OUTPUT
  3. Firmware job runs only if a new release was published (if: needs.release.outputs.new-release-published == 'true')
  4. Checks out the release tag, installs ARM toolchain, clones micropython-steami, links drivers, builds
  5. Attaches steami-firmware-vX.Y.Z.hex and steami-firmware-vX.Y.Z.bin to the GitHub release

Files changed

  • .github/workflows/release.yml: added outputs on release job, added firmware job
  • .releaserc.json: added publishCmd to @semantic-release/exec for GitHub Actions outputs

Closes #283

Test plan

  • CI passes on this PR
  • Next release on main triggers firmware build and attaches .hex and .bin

Copilot AI review requested due to automatic review settings March 28, 2026 16:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 firmware job 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.

Comment thread .github/workflows/release.yml Outdated
Comment on lines +77 to +86
- 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
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
- 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

Copilot uses AI. Check for mistakes.
Comment thread .releaserc.json Outdated
["@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"
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
"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\"; }"

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/release.yml Outdated
sudo apt-get install -y --no-install-recommends gcc-arm-none-eabi libnewlib-arm-none-eabi

- name: Clone MicroPython
run: |
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
run: |
run: |
mkdir -p .build

Copilot uses AI. Check for mistakes.
@nedseb nedseb force-pushed the ci/firmware-release-asset branch from c71bca6 to c91ba59 Compare March 28, 2026 16:20
@nedseb nedseb force-pushed the ci/firmware-release-asset branch from c91ba59 to 56f28f9 Compare March 28, 2026 16:22
@nedseb
Copy link
Copy Markdown
Contributor Author

nedseb commented Mar 28, 2026

Commentaires Copilot traités dans 9f7e783 :

  1. Duplication de make firmware — obsolète, le workflow utilise déjà make firmware depuis la dernière version poussée.
  2. publishCmd plante si $GITHUB_OUTPUT non défini — corrigé avec un guard [ -n "${GITHUB_OUTPUT:-}" ] et fallback || true pour les dry-runs locaux.
  3. .build/ n'existe pas sur un runner frais — obsolète, make firmware crée le répertoire via le Makefile.

Aussi corrigé un mismatch de nommage : les cp utilisaient steami-firmware- mais le gh release upload cherchait steami-micropython-firmware-. Aligné sur steami-micropython-firmware-.

@nedseb nedseb merged commit 9fef5bf into main Mar 28, 2026
9 checks passed
@nedseb nedseb deleted the ci/firmware-release-asset branch March 28, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: Attach firmware to GitHub releases.

2 participants