-
Notifications
You must be signed in to change notification settings - Fork 3
feat(workflows): add reusable Docusaurus workflow (DX-2760) #1398
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
base: main
Are you sure you want to change the base?
Changes from all commits
76ed36d
2aaf1ea
55d3740
090b262
12e7481
6cf2e6a
3414b74
98109fd
4575245
14e1a0b
2516202
33f8dd1
c22d83d
79b5c05
cc176e3
7cd8e0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| name: Reusable Docusaurus | ||
|
|
||
| ## | ||
| # Build and deploy Docusaurus documentation to GitHub Pages. | ||
| # | ||
| # This workflow is reusable and can be called from other workflows. | ||
| # It runs one job: checkout, setup Node.js, build (which validates the docs), | ||
| # upload pages artifact, and conditionally deploy (only on push to main). | ||
| # | ||
| # Example usage from a calling workflow: | ||
| # | ||
| # jobs: | ||
| # docusaurus: | ||
| # permissions: | ||
| # contents: read | ||
| # pages: write | ||
| # id-token: write | ||
| # uses: smartcontractkit/.github/.github/workflows/reusable-docusaurus.yml@<git-sha> | ||
| # with: | ||
| # build-command: pnpm -C ./docs run build | ||
| # build-output-directory: ./docs/build | ||
| # package-json-directory: ./docs | ||
| # ## | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| # nodejs inputs | ||
| node-version-file: | ||
| description: "path to .tool-versions file for node version" | ||
| required: false | ||
| type: string | ||
| default: ".tool-versions" | ||
| pnpm-version: | ||
| description: "the pnpm version to use" | ||
| required: false | ||
| type: string | ||
| default: "^10.0.0" | ||
| # docs-specific inputs | ||
| build-command: | ||
| description: "command to build the documentation (run from repository root, use pnpm -C to specify directory)" | ||
| required: false | ||
| type: string | ||
| default: "pnpm -C ./docs run build" | ||
| build-output-directory: | ||
| description: "directory where the built documentation is output (relative to repository root or absolute path)" | ||
| required: false | ||
| type: string | ||
| default: "build" | ||
| package-json-directory: | ||
| description: "the sub-directory of the package.json, if not at the root of the repository" | ||
| required: false | ||
| type: string | ||
| default: "." | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| docusaurus: | ||
| name: Build and Deploy Documentation | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup nodejs | ||
| uses: smartcontractkit/.github/actions/setup-nodejs@setup-nodejs/v1 | ||
Check warningCode scanning / CodeQL Unpinned tag for a non-immutable Action in workflow Medium
Unpinned 3rd party Action 'Reusable Docusaurus' step
Uses Step Error loading related location Loading
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chainchad we need to write the custom config to skip those findings for internal actions. |
||
| with: | ||
| node-version-file: ${{ inputs.node-version-file }} | ||
| pnpm-version: ${{ inputs.pnpm-version }} | ||
| use-cache: "true" | ||
| run-install: "true" | ||
| package-json-directory: ${{ inputs.package-json-directory }} | ||
| continue-on-error: true | ||
|
|
||
| - name: Build documentation | ||
| shell: bash | ||
| env: | ||
| BUILD_COMMAND: ${{ inputs.build-command }} | ||
| run: $BUILD_COMMAND | ||
|
|
||
| - name: Upload pages artifact | ||
| uses: actions/upload-pages-artifact@v4.0.0 | ||
| with: | ||
| path: ${{ inputs.build-output-directory }} | ||
|
|
||
| - name: Deploy to GitHub Pages | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
| uses: actions/deploy-pages@v4.0.5 | ||
erikburt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.