Add PR preview environments - #4
Merged
Merged
Conversation
Switch production deployment from artifact-based Pages to a gh-pages
branch (peaceiris/actions-gh-pages), enabling PR previews to coexist
as subdirectories alongside the live site.
Add preview.yml: on every PR open/sync/reopen, builds Hugo with a
PR-specific baseURL and deploys to pr-preview/pr-{number}/ on the
gh-pages branch via rossjrw/pr-preview-action. The action posts a
comment on the PR with the live preview URL and cleans up the
subdirectory automatically when the PR is closed.
https://claude.ai/code/session_01MA7Ekd1KB4MpXrC6aUeivs
|
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.
Summary
gh-pagesbranch (peaceiris/actions-gh-pages@v4), which allows PR previews to coexist as subdirectories alongside the live sitepreview.yml: on every PR open/sync/reopen, builds Hugo with a PR-specificbaseURLand deploys topr-preview/pr-{number}/viarossjrw/pr-preview-action; the action posts a comment on the PR with the live URL and auto-removes the subdirectory when the PR is closed-D) are included in previews so in-progress content is visible before publishcheckout@v7and the pinnedhugo-version: '0.155.3'already onmainAfter merging — one manual step required
GitHub Pages needs to be told to serve from the branch instead of Actions:
GitHub Actions→Deploy from a branchgh-pages, folder:/→ SaveThe
gh-pagesbranch is created automatically the first time the updateddeploy.ymlruns onmain(i.e. when this PR merges). Once Pages is pointed at it, the production URLhttps://mathieson.github.io/blog/stays exactly the same.Generated by Claude Code