Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/reusable-docusaurus.yml
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 warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Reusable Docusaurus' step
Uses Step
uses 'smartcontractkit/.github/actions/setup-nodejs' with ref 'setup-nodejs/v1', not a pinned commit hash
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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
10 changes: 0 additions & 10 deletions actions/docs-deploy/CHANGELOG.md

This file was deleted.

3 changes: 0 additions & 3 deletions actions/docs-deploy/README.md

This file was deleted.

84 changes: 0 additions & 84 deletions actions/docs-deploy/action.yml

This file was deleted.

11 changes: 0 additions & 11 deletions actions/docs-deploy/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions actions/docs-deploy/project.json

This file was deleted.

10 changes: 0 additions & 10 deletions actions/docs-test/CHANGELOG.md

This file was deleted.

3 changes: 0 additions & 3 deletions actions/docs-test/README.md

This file was deleted.

75 changes: 0 additions & 75 deletions actions/docs-test/action.yml

This file was deleted.

11 changes: 0 additions & 11 deletions actions/docs-test/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions actions/docs-test/project.json

This file was deleted.

4 changes: 0 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading