ci: set the site URL in preview deployments (#6244) (CP: v25.3) - #6249
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Redirects on preview deployments send readers to
`http://localhost:8210/...` instead of the preview host. This PR passes
each preview's own URL to the build, so redirects can be tested on the
preview.
## Cause
In a static build, Astro 4.15.9 (used by dspublisher 3.0.0-alpha.15)
writes each redirect as an HTML page with a `<meta
http-equiv="refresh">` tag. The target URL is made absolute with the
`site` setting (`astro/dist/core/build/generate.js`):
```js
const siteURL = config.site;
const location = siteURL ? new URL(locationSite, siteURL) : locationSite;
```
dspublisher sets `site` to `siteUrl`, and falls back to
`http://localhost:${port}` when `siteUrl` is empty. `Dockerfile.preview`
doesn't set it, so every preview redirect pointed to `localhost`.
Production isn't affected, because its build sets `siteUrl`.
## Change
- `preview-deploy.yml` passes
`DOCS_SITE_URL=https://docs-preview-pr-<number>.fly.dev` to `flyctl
deploy` as a build argument. That's the same URL the change manifest
step already uses.
- `Dockerfile.preview` declares the `DOCS_SITE_URL` build argument and
passes it to the dspublisher build. dspublisher reads `DOCS_SITE_URL`
before the `siteUrl` config value. Local builds of the Dockerfile leave
it unset and keep the old behavior.
## Other effects of setting the site URL
I checked every place where dspublisher uses `siteUrl`:
- **Sitemap:** its URLs point to the preview host instead of
`localhost`.
- **`og:image`:** pages with images get this meta tag, pointing to the
preview host. Before, the preview left it out.
- **Canonical links:** none change. dspublisher only writes them when a
versions list is configured, and the preview has none.
## Testing
- The workflow YAML parses.
- I couldn't reach the `fly.dev` previews from my environment, so I
haven't seen a redirect page built with this change. The preview for
this PR has no redirects to try, because the first redirects are added
in #6243. Once both PRs are merged, the next PR's preview
should redirect within the preview host.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.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.
Manual cherry-pick of #6244 to
v25.3. The automatic pick failed. This PR also picks the dspublisher bump to 3.0.0-alpha.15 (297d384), which #6244 depends on.Why the automatic pick failed
#6244 changes the line in
Dockerfile.previewthat runs dspublisher. Onmainthat line uses3.0.0-alpha.15. Onv25.3it still used3.0.0-alpha.13, because the bump was never picked tov25.3. Both changes touch the same line, so git couldn't apply #6244.Why the bump is included
The redirects from #6243 were cherry-picked to
v25.3in #6246. Butalpha.13has no redirect support and ignores theredirectssetting, so those redirects do nothing onv25.3until it usesalpha.15.Picking the bump first lets #6244 apply without conflicts, and both commits are unchanged from
main:chore: bump dsp version to 3.0.0-alpha.15updates the version inDockerfile.preview,dspublisher/dspublisher-scripts.js, and the license check.ci: set the site URL in preview deployments (#6244)passes the preview URL to the build, so redirects on previews stay on the preview host instead of going tolocalhost.Verification
v25.3.v25.3: none of the old pages exist there and every destination does.alpha.15fails the build if a redirect source is an existing page, so this needs to hold.v25.3or compile it locally. CI's compile check will cover the license check change, which is only a version string./flow/advanced/long-running-tasks.For reviewers
This moves
v25.3to dspublisheralpha.15, including everything that changed betweenalpha.13andalpha.15, not only redirect support.🤖 Generated with Claude Code