Repository navigation
Publish the site with GitHub Pages from the workflow, without the gh-pages branch - #155
Open
wl-estensd wants to merge 1 commit into
Open
wl-estensd wants to merge 1 commit into
wl-estensd wants to merge 1 commit into
Conversation
…pages branch The build job uploads the built and checked site/ directory as a Pages artifact. A new deploy job publishes that artifact with actions/deploy-pages. Both only run on master. - The site is no longer pushed to the gh-pages branch. - The workflow no longer needs write access to the repository contents. The build job has contents: read, the deploy job has pages: write and id-token: write. - Each deploy shows under Environments (github-pages) on GitHub. This needs a change in the repository settings by an admin: Settings -> Pages -> Source must be set to "GitHub Actions". Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
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.
This PR builds on #154 and should be merged after it. Its base is the branch of #154, so the diff only shows the changes of this PR.
Merging this needs one change in the repository settings by an admin. See "How to roll this out" below.
Why
Today the workflow pushes the finished website to the
gh-pagesbranch, and GitHub Pages serves that branch. This PR changes to the way GitHub recommends for new sites: the workflow hands the built site directly to GitHub Pages.gh-pagesbranch that looks "600 commits behind" and can be merged or deleted by mistake.github-pages) with its history.What changed
ghp-importpush is replaced byactions/upload-pages-artifactv5.0.0, which uploads thesite/directory that was built and checked in the steps before. Its permission goes fromcontents: writetocontents: read.actions/deploy-pagesv5.0.1 publishes that upload. It haspages: writeandid-token: write, and uses thegithub-pagesenvironment.master, as before. Nothing is rebuilt between the checks and the publish.README.md: one sentence about how the site is published.The published content is the same as today. The
CNAMEand.nojekyllfiles are no longer written, because they are only used by the branch way.How to roll this out
A repository admin has to change one setting: Settings -> Pages -> Build and deployment -> Source: "GitHub Actions" (today it is "Deploy from a branch",
gh-pages).Suggested order, to keep the time between the two changes short:
docs.waterlinked.comis still shown on the Pages settings page.gh-pagesbranch can be deleted. Keep it for a few days first: switching the Source setting back to the branch is the rollback.Checked
github-pagesenvironment already allows deploys frommaster(allowed branches:gh-pagesandmaster).docs.waterlinked.comwith HTTPS enforced.actionlint, and the run on this branch passes (the upload and deploy only run onmaster, so they are skipped here).Not tested
master, and the deploy needs the settings change.🤖 Generated with Claude Code