Repository navigation
Automate patch releases for public UMD apps - #28980
Conversation
WalkthroughThe PR updates public app versioning and publishing. It adds shared public app definitions and a matrix builder, rewrites the version consistency check to compare app package versions with defaults.json, adds a script to compute the next npm-published version within a major.minor line, and changes the CI publish job to use the generated matrix and publish flow. The manual release prompt now accepts only minor or major bumps, and the ActivityPub package no longer includes the public-app tag. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
a49690c to
cc5ab60
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/ci.yml (1)
1705-1713: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winMove the affected-project filter out of the job-level
if.matrix.package_nameisn’t available injobs.publish_public_apps.if, so this condition will break the workflow. Put the check on the publish steps or generate a filtered matrix instead.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/ci.yml around lines 1705 - 1713, The affected-project check is currently in the job-level publish guard, but matrix.package_name is not available there. Move the contains(fromJSON(needs.job_setup.outputs.affected_projects), matrix.package_name) logic out of jobs.publish_public_apps.if and apply it inside the publish steps or by generating a filtered matrix before the publish job runs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.github/workflows/ci.yml:
- Around line 1705-1713: The affected-project check is currently in the
job-level publish guard, but matrix.package_name is not available there. Move
the contains(fromJSON(needs.job_setup.outputs.affected_projects),
matrix.package_name) logic out of jobs.publish_public_apps.if and apply it
inside the publish steps or by generating a filtered matrix before the publish
job runs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d1303b55-c727-45d0-9357-cea46a814417
📒 Files selected for processing (5)
.github/scripts/check-app-version-bump.js.github/scripts/compute-next-app-version.js.github/scripts/release-apps.js.github/workflows/ci.ymlapps/activitypub/package.json
cc5ab60 to
e12176d
Compare
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin-x-settings:test:acceptance |
✅ Succeeded | 9m 56s | View ↗ |
nx run ghost:test:integration |
✅ Succeeded | 2m 46s | View ↗ |
nx run ghost:test:ci:integration |
✅ Succeeded | 3s | View ↗ |
nx run ghost:test:legacy |
✅ Succeeded | 2m 55s | View ↗ |
nx run ghost:test:e2e |
✅ Succeeded | 2m 29s | View ↗ |
nx run-many --target=build --projects=tag:publi... |
✅ Succeeded | <1s | View ↗ |
nx run @tryghost/activitypub:test:acceptance |
✅ Succeeded | 35s | View ↗ |
nx run @tryghost/comments-ui:test:acceptance |
✅ Succeeded | 46s | View ↗ |
Additional runs (7) |
✅ Succeeded | ... | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-30 15:38:36 UTC
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
1769-1771: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPin the npm 11 CLI version used for publishing. Both publish jobs install
npm@11, which floats to the latest 11.x patch on every run. Pin the exact tested patch version and update it intentionally in both places.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/ci.yml around lines 1769 - 1771, The publish workflow currently installs a floating npm 11 CLI version, so the release jobs can change behavior on every run. Update both publish job steps that run npm install -g npm@11 to use one exact pinned npm 11 patch version, and keep that version synchronized intentionally in both places.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 1769-1771: The publish workflow currently installs a floating npm
11 CLI version, so the release jobs can change behavior on every run. Update
both publish job steps that run npm install -g npm@11 to use one exact pinned
npm 11 patch version, and keep that version synchronized intentionally in both
places.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9d939cf3-f2f3-4178-8208-4a36cefd4433
📒 Files selected for processing (6)
.github/scripts/build-public-apps-matrix.js.github/scripts/check-app-version-bump.js.github/scripts/compute-next-app-version.js.github/scripts/release-apps.js.github/workflows/ci.ymlapps/activitypub/package.json
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/activitypub/package.json
- .github/scripts/release-apps.js
- .github/scripts/check-app-version-bump.js
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #28980 +/- ##
=======================================
Coverage 74.34% 74.34%
=======================================
Files 1565 1565
Lines 135727 135732 +5
Branches 16493 16490 -3
=======================================
+ Hits 100901 100905 +4
+ Misses 33831 33802 -29
- Partials 995 1025 +30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9larsons
left a comment
There was a problem hiding this comment.
Minor things, overall big fan of trying this out!
| let output; | ||
|
|
||
| try { | ||
| output = execFileSync('npm', ['view', packageName, 'versions', '--json'], {encoding: 'utf8'}); |
There was a problem hiding this comment.
Agents caught this using the OS default npm while later we pin to npm@11. Should we sync these?
There was a problem hiding this comment.
I don't think we need to necessarily - npm view is pretty stable. Afaict, the reason we install npm@11 later is to make sure oidc publishing works fully
e12176d to
5dc44f8
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/scripts/compute-next-app-version.js:
- Around line 34-37: Exclude prerelease versions when computing the patch floor
in compute-next-app-version.js. In the publishedVersions pipeline, update the
semver.parse/filter logic so only stable versions for the current major/minor
contribute to patchesInLine, and ignore any parsed version with a prerelease
field before taking version.patch.
In @.github/workflows/ci.yml:
- Around line 1723-1724: The publish_public_apps job is overriding the default
GITHUB_TOKEN permissions by setting only id-token: write, which removes the read
access needed by actions/checkout. Update the permissions block for
publish_public_apps to keep contents: read alongside id-token: write so the
checkout step can still access the repository.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fbadf5e2-92f7-40ab-bb53-7e467c795d24
📒 Files selected for processing (7)
.github/scripts/build-public-apps-matrix.js.github/scripts/check-app-version-bump.js.github/scripts/compute-next-app-version.js.github/scripts/public-apps.json.github/scripts/release-apps.js.github/workflows/ci.ymlapps/activitypub/package.json
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/activitypub/package.json
- .github/scripts/check-app-version-bump.js
ref https://linear.app/ghost/issue/PLA-185 - the PR-time version-bump gate was constantly missed (AI agents ignored it) and caused merge conflicts when multiple PRs touched the same app; this removes the manual step that was the source of both problems - on merge to main, each affected public app (nx tag:public-app) now gets its next patch computed from npm and published automatically — npm is the source of truth for the patch number, so package.json's patch can go stale and no version is committed back to main (avoiding protected-branch pushes/races) - works because Ghost core resolves apps via <pkg>@~<major.minor> on jsDelivr, so a new patch auto-propagates to every site with no core change; minor/major stay manual via 'pnpm ship' since they move the major.minor pinned in defaults.json (a deliberate rollout decision) - the remaining PR check now only enforces package.json major.minor == defaults.json, the one human coordination point for minor/major releases - removed the now-stale public-app tag from activitypub (leftover from its removed UMD build) so the tag cleanly selects the 6 CDN apps
5dc44f8 to
6467fd3
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
1782-1784: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low valueOptional: pass
matrix.cdn_pathsand version outputs viaenvinstead of inline${{ }}in the shell.
matrix.cdn_paths(and thesteps.releaseoutputs) are expanded directly into therunblock, which static analysis flags as template injection. The values originate from in-repopublic-apps.jsonon main-only runs, so the practical risk is low, but binding them throughenv:and referencing"$CDN_PATHS"removes the expansion surface entirely.🔒 Proposed hardening
- name: Replace version placeholders in cdn-paths id: cdn_paths + env: + CDN_PATHS: ${{ matrix.cdn_paths }} + CURRENT_MINOR: ${{ steps.release.outputs.current_minor }} + CURRENT_MAJOR: ${{ steps.release.outputs.current_major }} run: | - cdn_paths="${{ matrix.cdn_paths }}" echo "cdn_paths<<EOF" >> $GITHUB_OUTPUT - echo "$cdn_paths" | sed -e 's/CURRENT_MINOR/${{ steps.release.outputs.current_minor }}/g' -e 's/CURRENT_MAJOR/${{ steps.release.outputs.current_major }}/g' >> $GITHUB_OUTPUT + echo "$CDN_PATHS" | sed -e "s/CURRENT_MINOR/$CURRENT_MINOR/g" -e "s/CURRENT_MAJOR/$CURRENT_MAJOR/g" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/ci.yml around lines 1782 - 1784, The shell step in the CI workflow is expanding `matrix.cdn_paths` and `steps.release` outputs inline, which triggers template-injection warnings; move these values into `env:` for the job/step and reference them as shell variables inside the `run` block instead. Update the affected workflow step that writes `cdn_paths` to `$GITHUB_OUTPUT` so it uses those env vars rather than `${{ }}` expressions, and keep the `sed` replacements driven by the environment-backed values.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 1782-1784: The shell step in the CI workflow is expanding
`matrix.cdn_paths` and `steps.release` outputs inline, which triggers
template-injection warnings; move these values into `env:` for the job/step and
reference them as shell variables inside the `run` block instead. Update the
affected workflow step that writes `cdn_paths` to `$GITHUB_OUTPUT` so it uses
those env vars rather than `${{ }}` expressions, and keep the `sed` replacements
driven by the environment-backed values.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4573e332-259c-4fa4-ba6d-2c0059e1ba68
📒 Files selected for processing (7)
.github/scripts/build-public-apps-matrix.js.github/scripts/check-app-version-bump.js.github/scripts/compute-next-app-version.js.github/scripts/public-apps.json.github/scripts/release-apps.js.github/workflows/ci.ymlapps/activitypub/package.json
✅ Files skipped from review due to trivial changes (1)
- .github/scripts/public-apps.json
🚧 Files skipped from review as they are similar to previous changes (4)
- apps/activitypub/package.json
- .github/scripts/release-apps.js
- .github/scripts/build-public-apps-matrix.js
- .github/scripts/check-app-version-bump.js

ref https://linear.app/ghost/issue/PLA-185
Problem
The PR-time version-bump gate for public apps in
apps/*was constantly missed (AI agents ignored it) and caused merge conflicts whenever multiple PRs touched the same app. The bump was a manual chore that, by design, had to change the same line in two files.Approach
Stop tracking the patch number in git — make npm the source of truth and publish patches automatically on merge to
main. No version is committed back, so there are no protected-branch pushes or races.This works because Ghost core resolves each app via
<pkg>@~<major.minor>on jsDelivr, so a newly published patch auto-propagates to every site with no core change. Minor/major releases stay manual (viapnpm ship) because they move themajor.minorpinned indefaults.json— a deliberate rollout decision.What changed
compute-next-app-version.js(new) — derives the next patch from npm for an app'smajor.minorline (or publishespackage.json's exact version when starting a fresh minor/major line). Pure function + unit-tested.ci.yml → publish_public_apps— each matrix leg is gated on whether the app is inaffected_projects; it computes + writes the version withnpm pkg setbefore building (so portal's embeddedREACT_APP_VERSIONmatches what's published), then publishes. Added per-appconcurrencyso two quick merges can't collide on the same next patch.check-app-version-bump.js— dropped the "must bump above main" rule (and ~165 lines of now-dead semver helpers). It now only enforcespackage.jsonmajor.minor ==defaults.json— the one human coordination point for minor/major. Job name kept stable so required-status-check config isn't affected.release-apps.js(pnpm ship) — now minor/major-only (defaultminor), with a note that patches are automated.apps/activitypub/package.json— removed the stalepublic-apptag (leftover from its removed UMD build) sotag:public-appcleanly selects the 6 CDN apps.Note for reviewers
The publish gate reuses the existing
affected_projectsoutput, whoseAFFECTED_ARGbecomes "everything" when CI-globals (.github/**, lockfile, etc.) change on a main push. So a CI-only merge would patch-bump all 6 apps — identical bundles, forward-only, harmless but noisy. If we'd prefer CI-only changes not to republish apps, the fix is a dedicated strict---affectedpublic-app output instead of reusingaffected_projects. Left as reuse for now; trivial to switch.🤖 Generated with Claude Code