Skip to content

Removed GHOST_CDN_URL from CI admin build#26556

Closed
rob-ghost wants to merge 1 commit intomainfrom
chore/remove-ghost-cdn-url-ci
Closed

Removed GHOST_CDN_URL from CI admin build#26556
rob-ghost wants to merge 1 commit intomainfrom
chore/remove-ghost-cdn-url-ci

Conversation

@rob-ghost
Copy link
Contributor

Context

This is PR 3 of 3 in the deploy-time admin rewrite initiative.

Proposal: Build once, deploy everywhere — deploy-time index.html rewrite

Summary

Ghost(Pro) currently bakes GHOST_CDN_URL=https://assets.ghost.io/admin-forward/ into the admin build at CI time, producing absolute CDN URLs in the artifact. This means Ghost-Moya must string-replace production URLs with staging URLs at deploy time — a fragile process that couples the build to the deployment target.

The new approach builds admin with relative paths (./assets/...) and a ghost-cdn-url meta tag. At deploy time, a simple sed command in Ghost-Moya rewrites index.html per environment — no Node.js script, no string replacement across JS bundles.

What this PR does

  • Removes the GHOST_CDN_URL environment variable from the deploy_admin CI job
  • Adds a validation step that confirms the build output:
    • Uses relative asset paths (./assets/)
    • Includes the ghost-cdn-url meta tag (added by PR 1)

Dependencies

PR Status
PR 1: Ghost #26555 — meta tag + bridge script Must be merged first
PR 2: Ghost-Moya #135 — sed-based deploy Must be deployed first

Merge order: PR 1 → PR 2 → this PR. If this merges before PR 2 is deployed, the deploy workflow would receive a relative-path artifact but still try the old Node.js replacement — which would silently produce broken staging builds.

Impact

  • Ghost(Pro): Admin artifacts switch from absolute CDN URLs to relative paths. Ghost-Moya's deploy workflow (PR 2) detects the format and applies sed rewriting.
  • Self-hosted: No change. GHOST_CDN_URL remains a supported build-time option in vite.config.ts — only the CI environment variable is removed.

Test plan

  • CI build produces apps/admin/dist/index.html with relative paths
  • Validation step passes (relative paths present, ghost-cdn-url meta present)
  • After deploy via Ghost-Moya, staging admin loads assets from staging CDN
  • After deploy via Ghost-Moya, production admin loads assets from production CDN
  • Self-hosted builds with GHOST_CDN_URL still work as before

The admin build no longer needs GHOST_CDN_URL baked in at build time.
Deploy-time index.html rewriting (in Ghost-Moya) handles CDN URL
injection per environment instead. A validation step confirms the
build output uses relative paths and includes the ghost-cdn-url meta
tag needed by the deploy-time rewrite.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/remove-ghost-cdn-url-ci

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 and usage tips.

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.13%. Comparing base (63703ac) to head (92faa69).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26556      +/-   ##
==========================================
- Coverage   73.14%   73.13%   -0.01%     
==========================================
  Files        1528     1528              
  Lines      120154   120156       +2     
  Branches    14506    14504       -2     
==========================================
- Hits        87886    87879       -7     
- Misses      31247    31272      +25     
+ Partials     1021     1005      -16     
Flag Coverage Δ
admin-tests 53.74% <ø> (+0.01%) ⬆️
e2e-tests 73.13% <ø> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@rob-ghost
Copy link
Contributor Author

Closing — no longer needed. PR #26546 introduces a separate admin-build-cd artifact with relative paths for cd.yml, so the existing CI build still needs GHOST_CDN_URL for the deploy-admin.yml flow. The two deploy paths are now decoupled.

@rob-ghost rob-ghost closed this Feb 24, 2026
@rob-ghost rob-ghost deleted the chore/remove-ghost-cdn-url-ci branch February 24, 2026 14:55
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