From a5e7ecf008c964c3cebe94aa2a1a1278867e2cfe Mon Sep 17 00:00:00 2001 From: Tom Riglar Date: Fri, 13 Nov 2026 11:57:58 +0000 Subject: [PATCH 1/2] ci: resolve version-file conflicts in the back-merge to production's side Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-please.yml | 20 +++++++++++++++++--- CLAUDE.md | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 9404984..11a5377 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -146,10 +146,24 @@ jobs: git checkout -b "$BRANCH" # A merge, so the PR's diff is exactly what `production` changed. + # + # The version files can conflict: the last back-merge was squashed, + # so git still sees dev's and production's version lines as two + # separate edits (5.12.1 hit this). `production` holds what was just + # released, so its side is right for those three files. Any other + # conflict still stops the job for a human. if ! git merge --no-ff origin/production -m "chore: merge production into dev after ${VERSION}"; then - echo "Back-merge of production into dev conflicts — resolve it by hand." >&2 - git merge --abort || true - exit 1 + conflicts=$(git diff --name-only --diff-filter=U) + others=$(grep -vxE 'package\.json|server\.json|CHANGELOG\.md' <<<"$conflicts" || true) + if [ -n "$others" ]; then + echo "::error::Back-merge of production into dev conflicts in $(paste -sd, - <<<"$others"). Resolve it by hand." + git merge --abort || true + exit 1 + fi + echo "::notice::Took production's side of the version-file conflicts: $(paste -sd, - <<<"$conflicts")" + git checkout --theirs -- $conflicts + git add -- $conflicts + git commit --no-edit fi if git diff --quiet "origin/dev..HEAD"; then diff --git a/CLAUDE.md b/CLAUDE.md index 570d0d8..c73acc9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -80,7 +80,7 @@ Full guide in `CONTRIBUTING.md`; the operationally important parts (the ones tha | **stable** | every push to `dev` runs **Promote to stable** (`promote.yml`), which keeps one release PR into `production` current; merging it tags, publishes and uploads binaries | `X.Y.Z` | `latest` | | **beta** | run **Release beta** (`release-beta.yml`) by hand from `dev` | `X.Y.Z-beta.N` | `beta` | -**Cutting a stable release.** You don't start one: you merge the open `chore: release X.Y.Z` PR from `promote/cli-next` into `production`. Use a **merge commit**, the only method `production` allows. That push runs `release-please.yml`. It finds an untagged version on `production`, tags it, and creates the GitHub Release from the changelog section. It then **chains** into `npm-publish.yml` and `release-binaries.yml` as `needs:` jobs, because a `GITHUB_TOKEN`-created release won't fire `release: published`. Last, it opens a **back-merge PR** into `dev`. `get.devicecloud.dev` serves the binaries by reading the GitHub Releases API at runtime, so there's no separate manifest to deploy. To hold a release, just don't merge the PR. Closing it doesn't pause releases, because the next push to `dev` opens a new one. +**Cutting a stable release.** You don't start one: you merge the open `chore: release X.Y.Z` PR from `promote/cli-next` into `production`. Use a **merge commit**, the only method `production` allows. That push runs `release-please.yml`. It finds an untagged version on `production`, tags it, and creates the GitHub Release from the changelog section. It then **chains** into `npm-publish.yml` and `release-binaries.yml` as `needs:` jobs, because a `GITHUB_TOKEN`-created release won't fire `release: published`. Last, it opens a **back-merge PR** into `dev`. If that merge conflicts only in `package.json`, `server.json` or `CHANGELOG.md`, it takes `production`'s side, which holds the version just released. A conflict in any other file stops the job, and you build the back-merge by hand. `get.devicecloud.dev` serves the binaries by reading the GitHub Releases API at runtime, so there's no separate manifest to deploy. To hold a release, just don't merge the PR. Closing it doesn't pause releases, because the next push to `dev` opens a new one. **How the release PR is kept current.** `promote.yml` runs on every push to `dev`. It rebuilds `promote/cli-next` from `origin/dev`, with `origin/production` merged in, plus one `chore: release X.Y.Z` commit that sets the version in `package.json` and `server.json` and adds the `CHANGELOG.md` section. Then it force-pushes the branch and opens the PR, or updates the open one's title and body. So the PR always carries all of `dev`, and its version moves up as `feat`s land. A push with nothing releasable since the last release, such as a docs change or the back-merge, does nothing. If `production` moved during the run because a release just merged, the run pushes nothing, and the back-merge's push into `dev` rebuilds the PR. If an open PR into `production` came from another branch, push runs warn and leave it alone. The workflow can also be run by hand (`gh workflow run promote.yml --ref dev`, or the Actions tab) to set the `version`. `dry_run: true` shows the version and changelog in the run summary and pushes nothing. The `CHANGELOG.md` date is the day the PR was last rebuilt. From 5155ee6fc330d892fa985c2825eab262c1cf642a Mon Sep 17 00:00:00 2001 From: Tom Riglar Date: Fri, 13 Nov 2026 12:00:49 +0000 Subject: [PATCH 2/2] ci: resolve back-merge version conflicts hunk by hunk, keeping dev's other edits Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-please.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 11a5377..7b941fc 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -160,8 +160,18 @@ jobs: git merge --abort || true exit 1 fi - echo "::notice::Took production's side of the version-file conflicts: $(paste -sd, - <<<"$conflicts")" - git checkout --theirs -- $conflicts + # Hunk by hunk, not `checkout --theirs`: that would take production's + # whole file and drop anything else dev changed in it, such as a + # dependency bump in package.json. + # merge-file needs real files; it can't read process substitutions. + tmp=$(mktemp -d) + for f in $conflicts; do + git show ":1:$f" > "$tmp/base" + git show ":2:$f" > "$tmp/ours" + git show ":3:$f" > "$tmp/theirs" + git merge-file -p --theirs "$tmp/ours" "$tmp/base" "$tmp/theirs" > "$f" + done + echo "::notice::Took production's side of the conflicting lines in: $(paste -sd, - <<<"$conflicts")" git add -- $conflicts git commit --no-edit fi