Skip to content

feat(ci): attach rpi-image PR builds as draft preview releases - #194

Closed
frahlg wants to merge 1 commit into
pi-gen-trimfrom
pr-image-preview
Closed

frahlg wants to merge 1 commit into
pi-gen-trimfrom
pr-image-preview

Conversation

@frahlg

@frahlg frahlg commented Apr 25, 2026

Copy link
Copy Markdown
Member

Why

GitHub Actions auto-wraps every workflow artifact in a `.zip`, which Raspberry Pi Imager and balenaEtcher refuse to handle (they expect raw `.img` / `.img.xz`). Testers had to manually unzip the wrapper before flashing — clunky enough that it bit us during the first real-hardware test of #186.

Stacked on #193. Final piece in the rpi-image PR chain.

What

Two coordinated workflow changes:

  1. `rpi-image-build.yml` gains a release-attach step. On `pull_request` from the same repo, it attaches the built `.img.xz` to a draft pre-release tagged `pr--image-preview`. Asset is downloadable directly (no zip wrapper), draft so it stays out of the public Releases page, and upserted on each push. Forks skipped (their `GITHUB_TOKEN` doesn't have `contents: write`).

  2. New `rpi-preview-cleanup.yml` fires on PR close (merged or rejected) and deletes the matching tag + draft release. Best-effort — PRs that never produced a preview (no image-path changes) simply 404, that's fine.

Production tagged releases continue through `release.yml` unchanged.

Test plan

  • Commit + CI run on this PR will exercise the new step on itself — preview release should appear in the Releases → Drafts tab during build.
  • Closing this PR (after merge) should remove the draft release within ~30s via cleanup workflow.

🤖 Generated with Claude Code

GitHub Actions auto-wraps every workflow artifact in a .zip, which
Raspberry Pi Imager and balenaEtcher refuse to handle (they expect
raw .img / .img.xz). Testers had to manually unzip the wrapper
before flashing — clunky enough that it bit us during the first
real-hardware test.

Two coordinated workflow changes:

1. rpi-image-build.yml gets a final step that, on pull_request from
   the same repo, attaches the .img.xz to a draft pre-release
   tagged `pr-<N>-image-preview`. The asset is downloadable
   directly (no zip wrapper), draft so it stays out of the public
   Releases page, and upserted on each push so the PR has at most
   one preview at a time. Forks skipped — their GITHUB_TOKEN
   doesn't have contents:write.

2. rpi-preview-cleanup.yml fires on PR close (merged or rejected)
   and deletes the matching tag + draft release. Best-effort —
   PRs that never produced a preview (no image-path changes)
   simply 404 and that's fine.

Production tagged releases continue to flow through release.yml
unchanged. This is purely for review-cycle testing.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7edc493db

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +147 to +149
if: |
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Skip preview upload if the PR has already closed

This step can recreate preview releases for closed PRs because the image build may run for a long time and finish after the PR is closed. The cleanup workflow only runs once on the pull_request.closed event, but this condition only checks event_name and same-repo origin, so an in-flight run triggered earlier will still publish pr-<N>-image-preview after cleanup has deleted it, leaving orphan draft releases/tags. A runtime check of the PR's current state (via API) before calling action-gh-release would prevent that.

Useful? React with 👍 / 👎.

@frahlg frahlg closed this Apr 25, 2026
@frahlg
frahlg deleted the pr-image-preview branch April 25, 2026 16:31
frahlg added a commit that referenced this pull request Nov 25, 2026
Move the pin to srcfl/device-drivers@28c771fd (#279). zaptec_cloud 0.3.0
uses host.set_command_timeout_s and driver_release from this PR. The pin
also carries the easee_cloud fixes merged since e7b94b11 (#183, #227, #194,
#236, #200), whose Core side (#2050, #2062) is already on master.

Tell the stopped instance's default apart from a replacement's startup
default in TestOtherStopsKeepTheSafeDefault (review finding).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
frahlg added a commit that referenced this pull request Nov 25, 2026
…val (#2079)

* fix(drivers): give slow cloud drivers time, hand devices back on removal

A Zaptec Cloud command that took longer than 5 s failed, and the safe
default then paused the charger at 0 A. A driver can now ask for up to
30 s per call with host.set_command_timeout_s; the control tick still waits
only its short deadline and the call finishes in the driver's queue.

Removing or disabling a driver calls its optional driver_release instead of
driver_default_mode, so a charger goes back to the owner's own current
rather than staying at FTW's 0 A. Restarts, shutdown and stale readings
keep the safe default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(drivers): bundle zaptec_cloud 0.3.0 and easee_cloud 1.5.0

Move the pin to srcfl/device-drivers@28c771fd (#279). zaptec_cloud 0.3.0
uses host.set_command_timeout_s and driver_release from this PR. The pin
also carries the easee_cloud fixes merged since e7b94b11 (#183, #227, #194,
#236, #200), whose Core side (#2050, #2062) is already on master.

Tell the stopped instance's default apart from a replacement's startup
default in TestOtherStopsKeepTheSafeDefault (review finding).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

1 participant