Skip to content

Automate patch releases for public UMD apps - #28980

Merged
acburdine merged 1 commit into
mainfrom
austin-pla-185-automate-app-version-bumps-for-apps-changes
Jun 30, 2026
Merged

acburdine merged 1 commit into
mainfrom
austin-pla-185-automate-app-version-bumps-for-apps-changes

Conversation

@acburdine

Copy link
Copy Markdown
Member

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 (via pnpm ship) because they move the major.minor pinned in defaults.json — a deliberate rollout decision.

What changed

  • compute-next-app-version.js (new) — derives the next patch from npm for an app's major.minor line (or publishes package.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 in affected_projects; it computes + writes the version with npm pkg set before building (so portal's embedded REACT_APP_VERSION matches what's published), then publishes. Added per-app concurrency so 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 enforces package.json major.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 (default minor), with a note that patches are automated.
  • apps/activitypub/package.json — removed the stale public-app tag (leftover from its removed UMD build) so tag:public-app cleanly selects the 6 CDN apps.

Note for reviewers

The publish gate reuses the existing affected_projects output, whose AFFECTED_ARG becomes "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---affected public-app output instead of reusing affected_projects. Left as reuse for now; trivial to switch.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The 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

  • TryGhost/Ghost#28850: Also changes the public app publish workflow wiring in .github/workflows/ci.yml.
  • TryGhost/Ghost#28894: Shares the same public-app publish/versioning area and related CI job logic changes.

Suggested reviewers

  • mike182uk
  • 9larsons
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly captures the main change: automating patch releases for public UMD apps.
Description check ✅ Passed The description is directly related to the changeset and accurately explains the automation and versioning updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch austin-pla-185-automate-app-version-bumps-for-apps-changes

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@acburdine
acburdine force-pushed the austin-pla-185-automate-app-version-bumps-for-apps-changes branch from a49690c to cc5ab60 Compare June 29, 2026 23:14
@acburdine
acburdine requested a review from 9larsons June 29, 2026 23:14

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 win

Move the affected-project filter out of the job-level if. matrix.package_name isn’t available in jobs.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

📥 Commits

Reviewing files that changed from the base of the PR and between 5734a5d and cc5ab60.

📒 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.yml
  • apps/activitypub/package.json

@acburdine
acburdine force-pushed the austin-pla-185-automate-app-version-bumps-for-apps-changes branch from cc5ab60 to e12176d Compare June 30, 2026 14:09
@nx-cloud

nx-cloud Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 5dc44f8

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

1769-1771: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Pin 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

📥 Commits

Reviewing files that changed from the base of the PR and between cc5ab60 and e12176d.

📒 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.yml
  • apps/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

codecov Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.34%. Comparing base (332a6b2) to head (6467fd3).
⚠️ Report is 1 commits behind head on main.

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     
Flag Coverage Δ
e2e-tests 76.48% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@9larsons 9larsons left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor things, overall big fan of trying this out!

let output;

try {
output = execFileSync('npm', ['view', packageName, 'versions', '--json'], {encoding: 'utf8'});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agents caught this using the OS default npm while later we pin to npm@11. Should we sync these?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

@acburdine
acburdine force-pushed the austin-pla-185-automate-app-version-bumps-for-apps-changes branch from e12176d to 5dc44f8 Compare June 30, 2026 15:15

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between e12176d and 5dc44f8.

📒 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.yml
  • apps/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

Comment thread .github/workflows/ci.yml Resolved
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
@acburdine
acburdine force-pushed the austin-pla-185-automate-app-version-bumps-for-apps-changes branch from 5dc44f8 to 6467fd3 Compare June 30, 2026 15:25

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

1782-1784: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

Optional: pass matrix.cdn_paths and version outputs via env instead of inline ${{ }} in the shell.

matrix.cdn_paths (and the steps.release outputs) are expanded directly into the run block, which static analysis flags as template injection. The values originate from in-repo public-apps.json on main-only runs, so the practical risk is low, but binding them through env: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5dc44f8 and 6467fd3.

📒 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.yml
  • apps/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

@acburdine
acburdine enabled auto-merge (squash) June 30, 2026 15:35
@acburdine
acburdine merged commit ab9714e into main Jun 30, 2026
47 checks passed
@acburdine
acburdine deleted the austin-pla-185-automate-app-version-bumps-for-apps-changes branch June 30, 2026 15:39
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.

2 participants