-
Notifications
You must be signed in to change notification settings - Fork 575
Fix: deploy documentation workflow #3101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+90
−77
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
81bf3ed
deploy-docs-workflow: remove checks of the git-branch ref
ckeshava b20ac6a
deploy docs only on tag push of the form
ckeshava 1878fd3
feat: generate docs only if all the tests pass successfully
ckeshava 703f7f3
Merge branch 'main' into fixDocsGen
ckeshava fefa385
update the instructions for docs update in CONTRIBUTING file
ckeshava 30d614a
update regex to match tags of the form xrpl@A.B.C
ckeshava 9f4942d
feat: generate documentation only on tag push
ckeshava 2096913
shift the tag pattern matching check into generate-documentation work…
ckeshava bdbfdd3
update CONTRIBUTING instructions
ckeshava e8b612b
refactor: migrate docs generation and publish step into the Release w…
ckeshava 45f6005
Merge branch 'main' into fixDocsGen
ckeshava 646e6e1
feat: Introduce conditional trigger of docs generation; Docs are gene…
ckeshava e654a5a
remove the manual instructions for updating the docs
ckeshava d2ee547
feat: eliminate the usage of github.inputs.branch_name
ckeshava 4c14207
update the instructions on contributing doc
ckeshava File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| name: Generate Documentation | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| git_ref: | ||
| description: 'Git ref to checkout (branch, tag, or commit SHA)' | ||
| required: true | ||
| type: string | ||
|
|
||
| env: | ||
| GIT_REF: ${{ inputs.git_ref }} | ||
|
|
||
| jobs: | ||
| generate-documentation: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| node-version: [22.x] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ env.GIT_REF }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
|
|
||
| - name: Setup npm version 10 | ||
| run: | | ||
| npm i -g npm@10 --registry=https://registry.npmjs.org | ||
| - name: Cache node modules | ||
| id: cache-nodemodules | ||
| uses: actions/cache@v4 | ||
| env: | ||
| cache-name: cache-node-modules | ||
| with: | ||
| # caching node_modules | ||
| path: | | ||
| node_modules | ||
| */*/node_modules | ||
| key: ${{ runner.os }}-deps-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-deps-${{ matrix.node-version }}- | ||
| - name: Install Dependencies | ||
| if: steps.cache-nodemodules.outputs.cache-hit != 'true' | ||
| run: npm ci | ||
|
|
||
| - run: npm run build | ||
|
|
||
| - name: Generate Documentation | ||
| run: npm run docgen | ||
|
|
||
| - name: Upload documentation files as artifact | ||
| id: docs-artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: docs/ | ||
| retention-days: 10 | ||
|
|
||
| deploy-docs-pages: | ||
| permissions: | ||
| id-token: write # Needed for OIDC authentication | ||
| pages: write # this permission is needed for deploying into Github Pages | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.docs-artifact.outputs.page_url }} | ||
| runs-on: ubuntu-latest | ||
| needs: generate-documentation | ||
| steps: | ||
| - name: Deploy to Documentation to GitHub Pages | ||
| id: docs-artifact | ||
| uses: actions/deploy-pages@v4 | ||
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Invalid inter-job output reference and missing job output exposure.
Line 71 attempts to reference
${{ steps.docs-artifact.outputs.page_url }}from thegenerate-documentationjob within thedeploy-docs-pagesjob environment configuration. This is invalid because:needs.job_id.outputs.keysyntax, notsteps.*.outputs.*.generate-documentationjob does not exposepage_urlas a job-level output—only the step defines it.deploy-docs-pagesjob redefinesid: docs-artifact(line 76), creating confusion with the upstream step.The
actions/deploy-pages@v4action outputspage_url, which will be available assteps.docs-artifact.outputs.page_urlwithin the deploy-docs-pages job after the deployment step executes. The environment URL should reference the output from the current step after it runs, but environment URLs are evaluated before step execution.Proposed fix:
This defers the URL evaluation to after the deployment step completes, allowing it to reference the current step's output. Also rename the step ID to
deploymentto avoid confusion with the artifact upload step.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The step-id values across different jobs need not be identical. Here is an example tutorial from the Github Actions readme file: https://github.com/actions/upload-pages-artifact?tab=readme-ov-file#usage
Furthermore, this Github Actions works correctly. I have verified the correct generation of docs in the target docs website.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ckeshava, you're absolutely correct, and I apologize for the confusion. Step IDs only need to be unique within a single job, not across jobs. In the
deploy-docs-pagesjob,steps.docs-artifact.outputs.page_urlcorrectly references theactions/deploy-pages@v4step within that same job, which does outputpage_urlas documented.The implementation is valid, and I appreciate you clarifying this and confirming that the workflow has been tested successfully. Thank you for the link to the official example as well!
🧠 Learnings used