Skip to content

ci: deploy docs via official GitHub Pages actions#559

Open
einarwar wants to merge 1 commit into
mainfrom
chore/ci-publish-docs-use-official-pages-actions
Open

ci: deploy docs via official GitHub Pages actions#559
einarwar wants to merge 1 commit into
mainfrom
chore/ci-publish-docs-use-official-pages-actions

Conversation

@einarwar
Copy link
Copy Markdown
Contributor

@einarwar einarwar commented May 19, 2026

Replace the hand-rolled git init + force-push-to-gh-pages approach in publish-docs.yaml with the officially supported actions/configure-pages, actions/upload-pages-artifact and actions/deploy-pages.

Why

  • OIDC-based deploy: no contents: write scope on GITHUB_TOKEN is needed for docs anymore.
  • No force-pushed gh-pages branch to maintain.
  • Uses the GitHub-managed github-pages environment, which gives you protection rules, a clean deploy history, and surfaces the deployment URL in the Actions run UI via environment.url (note: this is not exposed as a programmatic workflow output — nothing currently consumes it, so a workflow_call output isn't worth adding).

Other small cleanups in the same file (items 15 + a couple of bonus fixes)

  • Explicit permissions: block: contents: read, pages: write, id-token: write — required by actions/deploy-pages.
  • setup-uv now uses enable-cache: true, matching the other workflows.
  • Added a pages concurrency group with cancel-in-progress: false so Pages deploys are serialised but never interrupted mid-deploy.
  • Added timeout-minutes safety nets on both jobs.
  • Dropped the now-unused GITHUB_PAGES_BRANCH env var.

⚠️ One-time manual step required before merging

The repository's Pages source must be switched to "GitHub Actions":
Settings → Pages → Build and deployment → Source → GitHub Actions.

While the source is still set to "Deploy from a branch", actions/deploy-pages will fail. Once switched, the existing gh-pages branch can be deleted (optional cleanup).

Interaction with other open PRs

  • chore(ci): declare least-privilege permissions for GITHUB_TOKEN #557 (least-privilege permissions) adds permissions: contents: write to the docs job in on-push-main-branch.yaml. After both PRs land, that needs to become pages: write, id-token: write, contents: read instead. Whichever PR merges second will need a trivial rebase — I'll do that follow-up.

@einarwar einarwar requested a review from a team as a code owner May 19, 2026 13:23
@einarwar einarwar requested a review from Copilot May 19, 2026 13:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the documentation deployment workflow by replacing the manual gh-pages branch force-push approach with GitHub’s official Pages actions-based pipeline, aligning the repo with OIDC-based deployments and GitHub-managed Pages history/environments.

Changes:

  • Replaces the git init + force-push flow with actions/configure-pages, actions/upload-pages-artifact, and actions/deploy-pages.
  • Splits the workflow into separate build and deploy jobs and targets the github-pages environment with the deployment URL.
  • Adds Pages-specific concurrency serialization, enables uv caching, and adds job timeouts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/publish-docs.yaml
Comment thread .github/workflows/publish-docs.yaml
Replace the hand-rolled 'git init + force push to gh-pages' approach
with the officially supported actions/configure-pages,
actions/upload-pages-artifact and actions/deploy-pages. This relies on
OIDC for authentication (no GITHUB_TOKEN write scope on contents
needed) and removes the force-pushed branch.

Also:
- Enable uv cache (enable-cache: true) for a faster build job.
- Add a 'pages' concurrency group with cancel-in-progress: false so
  Pages deployments are serialised but never interrupted.
- Add timeout-minutes safety nets to each job.
- Drop the now-unused GITHUB_PAGES_BRANCH env var.

NOTE: This requires the repository's Pages source to be set to
'GitHub Actions' (Settings -> Pages -> Build and deployment -> Source).
@einarwar einarwar force-pushed the chore/ci-publish-docs-use-official-pages-actions branch from 19f4dea to edd7e20 Compare May 19, 2026 13:45
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