Repository navigation
ci(release): open a cloudhal-template PR after each release (#111) - #135
Merged
Merged
Conversation
cloudhal-template, the Deploy to Cloudflare button's repository, drifted three releases behind. A new template job in release.yml (after a successful publish) calls template-sync.yml, also runnable by hand for a version npm has: - scripts/template-sync.ts copies src/, public/, astro.config.mjs and tsconfig.json from the blog starter that @cloudhal/cli@<version> ships (what `cloudhal init` copies), moves @cloudhal/* to ^<version>, fails closed on starter package.json fields it has no rule for, and is idempotent; --lock pins every @cloudhal/* in the lockfile to exactly <version> without running package code. - A copy of the synced template is installed with npm ci and deployed dry with WORKERS_CI=1 before any write token exists; the result is the PR's cloudhal/template-check commit status. The template keeps no workflow files: whether the button's copy may contain them is not documented. - A GitHub App token (TEMPLATE_SYNC_APP_CLIENT_ID variable, TEMPLATE_SYNC_APP_PRIVATE_KEY secret; contents, pull requests and commit statuses on cloudhal-template only) pushes cloudhal/v<version>, opens or updates the PR (never a fork's), and closes older ones as superseded. Without the App the job logs a notice and does nothing. CONTRIBUTING.md gets the after-the-release checklist (template, cloudhal.com, try.cloudhal.com), corrected re-run and manual-release notes, and the frozen-theme rule for renderer changes; the deploy-button guide explains how the template stays current. onNpm moves to release-plan.ts for both scripts. Refs #111 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Madraka <8898640+Madraka@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes #111. cloudhal-template, the repository behind the Deploy to Cloudflare button, fell three releases behind. After every release a PR now opens there automatically, with its check attached. The template side is cloudhal-dev/cloudhal-template#2: Dependabot plus README changes.
release.yml→templatejob (after a successfulpublish) calls the newtemplate-sync.yml. That workflow can also be run by hand (Actions › Template sync, versionx.y.z). It:scripts/template-sync.ts. The script copiessrc/,public/,astro.config.mjsandtsconfig.jsonfrom the blog starter that@cloudhal/cli@<version>ships, which is exactly whatcloudhal initcopies. It moves@cloudhal/*to^<version>and keeps template-specific files. It fails closed onpackage.jsonfields it has no rule for, and running it twice changes nothing.--lock, which refreshespackage-lock.jsonwith every@cloudhal/*pinned to exactly<version>and checked. No package code runs in this step.npm ciand runscloudhal deploy --dry-runwithWORKERS_CI=1. This happens before any write token exists.cloudhal/v<version>, and opens or updates the PR. Lookups are owner-qualified, so a fork's PR with the same branch name is never picked up.cloudhal/template-checkcommit status, closes oldercloudhal/v*PRs as superseded, and fails the run if the dry run failed.docs/guides/deploy-button.md: how the template and copies stay current.Why no workflow in the template
The button copies the template with Cloudflare's GitHub App, and Cloudflare's docs do not say whether that copy may contain
.github/workflows/. GitHub refuses workflow files pushed by an App without theworkflowspermission. Putting the check in the template could therefore break the button for everyone, so the check runs here and reports as a status instead.Owner setup (one time) for the job to run
cloudhal-release-sync. Untick Webhook › Active.Iv) and generate a private key (.pem).cloudhal-template. Do not install it oncloudhal.TEMPLATE_SYNC_APP_CLIENT_ID= the Client ID. This is the on/off switch.TEMPLATE_SYNC_APP_PRIVATE_KEY= the whole .pem. Delete the local file afterwards.0.6.1. This should openchore: Cloudhal 0.6.1 and the 0.6.1 starter themeon cloudhal-template with a greencloudhal/template-check. That sync should only changetokens.cssand the four ranges, plus the lockfile.mainrequiring a PR and thecloudhal/template-checkstatus.Verification (local)
packages/clitemplate-sync.test.ts(19 tests, offline, temp dirs) andrelease-plan.test.ts(5) pass.pnpm size:checkpass.node scripts/publish-ci.ts --plan→publish=false version=0.6.1.uses:is pinned to a full SHA.create-github-app-tokenis v3.3.0,64ab729a…. checkout and setup-node reuse the SHAs already inrelease.yml.--checkreports the pending change.tokens.cssand four@cloudhal/*ranges.--lockchanges the 12@cloudhal/*lock entries (plus two in-range transitive packages).--checkand--lockchange nothing.npm cipasses, andWORKERS_CI=1 npx cloudhal deploy --dry-runprints "Dry run OK".Checklist
pnpm checkandcargo test --workspacepass locally. I ran the pieces that cover this change: scripts, their tests, docs and workflows; there is no package or Rust change.git commit -s, DCO)Closes #111
🤖 Generated with Claude Code