Skip to content

Conversation

@AritraDey-Dev
Copy link
Member

@AritraDey-Dev AritraDey-Dev commented Nov 22, 2025

This PR consolidates docs deployment into a single workflow with automatic PR previews and Github pages deployment.

Fixes #121

/cc @dlebauer

To pass the CI check need to follow step 4 mentioned in the issue i.e.

Once the PR is submitted or ready to submit, the following settings need to be changed by a maintainer
change build and deploy from 'deploy from a branch' to 'GitHub actions' (settings --> pages --> build and deploy)
Make sure the following are enabled
"Read and write permissions" for GITHUB_TOKEN (settings -> actions -> general --> workflow permissions
"Allow GitHub Actions to deploy to GitHub Pages” (settings --> actions --> general --> workflow permissions
Require status check for the job.

Copy link
Member

@dlebauer dlebauer left a comment

Choose a reason for hiding this comment

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

@AritraDey-Dev thanks for taking on this task, pr-previews will be a useful feature! I have updated the repository settings as indicated.

One change needed - right now the PR preview runs for all PRs, including forks, but the job fails because the action doesn't have permissions to push from the fork.

Please one of the following:

  1. (quickest, no previews from forks) don't allow builds on PRs from forks. This isn't ideal, but changing line 38 to if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository might work
  2. to enable previews from forks we could use a two-step process
    • pull_request workflow just builds sites and uploads it as an artifact
    • a separate script that can be triggered by a maintainer (workflow_dispatch) downloads the artifact and deploys it to a dedicated branch using GITHUB_TOKEN
  3. There may be other and possibly better ways to achieve the pr-previews.

@AritraDey-Dev AritraDey-Dev force-pushed the ci/docs-preview-workflow branch 3 times, most recently from 59d5621 to 797e90c Compare November 25, 2025 09:37
@AritraDey-Dev AritraDey-Dev force-pushed the ci/docs-preview-workflow branch from 797e90c to 9b6dd7a Compare November 25, 2025 09:46
@AritraDey-Dev AritraDey-Dev force-pushed the ci/docs-preview-workflow branch from a5786b5 to 1e812af Compare December 1, 2025 08:50
Signed-off-by: Aritra Dey <[email protected]>
Signed-off-by: Aritra Dey <[email protected]>
Signed-off-by: Aritra Dey <[email protected]>
Signed-off-by: Aritra Dey <[email protected]>
Signed-off-by: Aritra Dey <[email protected]>
Signed-off-by: Aritra Dey <[email protected]>
Signed-off-by: Aritra Dey <[email protected]>
Signed-off-by: Aritra Dey <[email protected]>
@AritraDey-Dev AritraDey-Dev force-pushed the ci/docs-preview-workflow branch from cc4197e to 4562db8 Compare December 1, 2025 11:03
"Ecosystem science, policy, and management informed by the best available data and models",
url: "https://pecanproject.github.io",
baseUrl: "/",
baseUrl: process.env.BASE_URL || "/",
Copy link
Collaborator

Choose a reason for hiding this comment

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

how does this change help with our current changes ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's required for a PR preview for the Docusaurus config. Actually, I was trying to deploy to gh pages using this workflow for a PR in my fork (just to test) , but in every case, the deployed URL was returning 404.
Then I found this fix in Docusaurus config here which fixes it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also For this PR, I was looking for a similar way to comment the PR preview automatically, very similar to what Netlify does. Unfortunately, that is only supported by GitHub Pages and GitHub Actions. So, we need to follow a two-step process for the preview, as @dlebauer mentioned in the 2nd option here. It seems like this is the only way to create a preview website for a PR.

@AritraDey-Dev AritraDey-Dev marked this pull request as draft December 7, 2025 18:23
@allgandalf
Copy link
Collaborator

@AritraDey-Dev let me know once you get this PR ready for review

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.

Automatically preview website on PR

3 participants