Skip to content

Update docs build to deploy from gh-pages branch to docs/ directory with preserved branch history - #5605

Merged
alliepiper merged 6 commits into
mainfrom
copilot/fix-e7490fb9-d1ef-4ba6-af32-449a806bd351
Aug 25, 2025
Merged

alliepiper merged 6 commits into
mainfrom
copilot/fix-e7490fb9-d1ef-4ba6-af32-449a806bd351

Conversation

Copilot AI commented Aug 20, 2025 •

Copy link
Copy Markdown
Contributor

This PR updates the documentation build and deployment process to use branch-based deployment instead of the GitHub Pages action, with documentation organized in a docs/ directory while preserving existing branch content for future multi-directory usage.

Changes Made

Workflow Updates (.github/workflows/build-docs.yml)

  • Replaced GitHub Pages action deployment with branch-based deployment using peaceiris/actions-gh-pages@v3
  • Combined build and deploy jobs into a single build-and-deploy job for efficiency
  • Updated permissions from pages: write, id-token: write to contents: write to allow pushing to branches
  • Removed GitHub Pages environment configuration as it's no longer needed
  • Added destination_dir: docs to deploy documentation to the docs/ directory in the gh-pages branch
  • Removed force_orphan: true to preserve existing content on the gh-pages branch for future multi-directory usage

Action Updates (.github/actions/docs-build/action.yml)

  • Removed actions/configure-pages@v3 setup step since we're not using GitHub Pages action
  • Updated descriptions to reflect the new branch-based deployment approach
  • Maintained backward compatibility for artifact uploads

Key Benefits

  1. Simplified deployment: Deploys directly to gh-pages branch instead of through GitHub Pages action
  2. Preserved branch history: Maintains existing branch content and history for future multi-directory usage
  3. Reduced complexity: Eliminates the need for Pages-specific configuration and permissions
  4. Maintained functionality: All existing build processes and artifact generation remain unchanged
  5. Organized structure: Documentation is now deployed to the docs/ directory for better organization
  6. Future-ready: Allows for additional subdirectories for pr-reviews, multi-versioned docs, etc.

Configuration Required

Repository maintainers will need to update the GitHub Pages settings to deploy from the gh-pages branch instead of GitHub Actions. The workflow will automatically create the gh-pages branch on the first deployment, with documentation located in the docs/ directory.

Technical Details

The deployment now uses the well-established peaceiris/actions-gh-pages@v3 action with the following configuration:

  • Publishes from the _site directory (same as before)
  • Uses the default GITHUB_TOKEN for authentication
  • Deploys to the gh-pages branch with preserved history (no force_orphan)
  • Places documentation in the docs/ directory within the gh-pages branch
  • Preserves existing content on the branch for future multi-directory usage

This change maintains all existing documentation generation logic while switching to a more standard branch-based deployment approach with organized directory structure and preserved branch history.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@copy-pr-bot

copy-pr-bot Bot commented Aug 20, 2025

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Copilot AI changed the title [WIP] Update the docs build to deploy from a branch instead of from an action. Update docs build to deploy from gh-pages branch instead of GitHub Pages action Aug 20, 2025
Copilot AI requested a review from jrhemstad August 20, 2025 22:46
@shwina
shwina marked this pull request as ready for review August 21, 2025 13:56
@shwina
shwina requested a review from a team as a code owner August 21, 2025 13:56
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Aug 21, 2025
@shwina
shwina marked this pull request as draft August 21, 2025 13:56
@cccl-authenticator-app cccl-authenticator-app Bot moved this from In Review to In Progress in CCCL Aug 21, 2025
@shwina

shwina commented Aug 21, 2025

Copy link
Copy Markdown
Contributor

my bad @jrhemstad - I marked this PR ready for review by mistake, intending to do that for one of my Copilot PRs.

Comment thread .github/workflows/build-docs.yml Outdated
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
publish_branch: gh-pages
force_orphan: true

@jrhemstad jrhemstad Aug 21, 2025 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot question: Why is force_orphan used here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot why is force_orphan used here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The force_orphan: true setting creates a clean deployment history by making each commit to the gh-pages branch an orphaned commit (no parent history). This prevents the gh-pages branch from accumulating a long history of documentation builds, keeping it lightweight and focused only on the current documentation state. Without this setting, every documentation deployment would add to the branch history, eventually making it very large with hundreds or thousands of build commits.

Copilot AI requested a review from jrhemstad August 21, 2025 18:10
@jrhemstad
jrhemstad marked this pull request as ready for review August 21, 2025 18:13
@cccl-authenticator-app cccl-authenticator-app Bot moved this from In Progress to In Review in CCCL Aug 21, 2025
@jrhemstad

Copy link
Copy Markdown
Collaborator

/ok to test bc925a5

@jrhemstad

Copy link
Copy Markdown
Collaborator

pre-commit.ci autofix

@jrhemstad

Copy link
Copy Markdown
Collaborator

/ok to test 6d4a1cc

@jrhemstad

Copy link
Copy Markdown
Collaborator

@copilot we want to update this so that docs are put in the docs/ dir in the gh-pages branch.

Copilot AI commented Aug 21, 2025

Copy link
Copy Markdown
Contributor Author

@copilot we want to update this so that docs are put in the docs/ dir in the gh-pages branch.

Updated the workflow to deploy docs to the docs/ directory in the gh-pages branch by adding destination_dir: docs to the deployment configuration. The documentation will now be organized under /docs/ instead of the root. (commit: ba7fcba)

Copilot AI changed the title Update docs build to deploy from gh-pages branch instead of GitHub Pages action Update docs build to deploy from gh-pages branch to docs/ directory instead of GitHub Pages action Aug 21, 2025
Comment thread .github/workflows/build-docs.yml Outdated
publish_dir: ./_site
publish_branch: gh-pages
destination_dir: docs
force_orphan: true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot we can't use force_orphan because it will wipe out anything else on the branch and we're going to want to use other subdirs in the future for pr-reviews, multi-versioned docs, etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed force_orphan: true to preserve existing content on the gh-pages branch. This will allow for future subdirectories like pr-reviews and multi-versioned docs without wiping out the branch content. (commit: 1ff7c57)

Copilot AI changed the title Update docs build to deploy from gh-pages branch to docs/ directory instead of GitHub Pages action Update docs build to deploy from gh-pages branch to docs/ directory with preserved branch history Aug 21, 2025
Copilot AI requested a review from jrhemstad August 21, 2025 20:04
@jrhemstad

Copy link
Copy Markdown
Collaborator

/ok to test 690e189

@jrhemstad

Copy link
Copy Markdown
Collaborator

fyi, I've already updated the repo settings to deploy from the gh-pages branch and docs/ directory and it deployed successfully https://github.com/NVIDIA/cccl/actions/runs/17218451712

@alliepiper
alliepiper merged commit 8e0acb5 into main Aug 25, 2025
@alliepiper
alliepiper deleted the copilot/fix-e7490fb9-d1ef-4ba6-af32-449a806bd351 branch August 25, 2025 19:30
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Aug 25, 2025
davebayer pushed a commit to davebayer/cccl that referenced this pull request Sep 23, 2025
…ith preserved branch history (NVIDIA#5605)

* Initial plan
* Update docs build to deploy from gh-pages branch instead of GitHub Pages action
Co-authored-by: jrhemstad <[email protected]>
* [pre-commit.ci] auto code formatting
* Update docs deployment to deploy to docs/ directory in gh-pages branch
Co-authored-by: jrhemstad <[email protected]>
* Remove force_orphan to preserve other directories on gh-pages branch

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jake Hemstad <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Update current docs to deploy from a branch (needed to support uploading multiple copies of the docs to different pr-preview folders)

4 participants