Skip to content

Docs

Docs #1

Workflow file for this run

name: Docs
on:
workflow_call:
inputs:
version:
description: 'The "name" of the version to be published.'
required: true
type: string
forcePush:
description: 'Pass `true` if git push should use `--force`.'
required: false
default: false
type: boolean
buildOnly:
description: 'Pass `true` to only build the docs, but not publish them. (Used by PR checks for dependabot and external contributors.)'
required: false
default: false
type: boolean
linkToPR:
description: 'Pass `true` if these docs are for a pull request. A link to the docs will be posted in a comment on the PR.'
required: false
default: false
type: boolean
workflow_dispatch:
inputs:
version:
description: 'The "name" of the version to be published. IMPORTANT: This only _names_ the published docs, it does not affect what is actually published. This workflow always builds and publishes the docs for whatever is the latest in the branch on which it is run.'
required: true
type: string
forcePush:
description: 'Pass `true` if git push should use `--force`.'
required: false
default: false
type: boolean
jobs:
publish-docs:
name: Publish Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: ./.github/actions/set-up-node
- run: npm ci
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "Lime Technologies OSS"
- name: Publish docs
if: github.event_name == 'workflow_dispatch' || inputs.buildOnly == false
env:
DOCS_VERSION: ${{ inputs.version || github.event.inputs.version }}
FORCE_PUSH: ${{ inputs.forcePush || github.event.inputs.forcePush || 'false' }}
GH_TOKEN: ${{ secrets.PUBLISH_DOCS }}
run: |
if [ "$FORCE_PUSH" = "true" ]; then
npm run docs:publish -- --v="$DOCS_VERSION" --forcePush
else
npm run docs:publish -- --v="$DOCS_VERSION"
fi
- name: Build docs, but do not publish
if: github.event_name == 'workflow_call' && inputs.buildOnly
run: npm run docs:build
link-docs:
if: github.event_name == 'workflow_call' && inputs.buildOnly == false && inputs.linkToPR == true
name: Post link to docs on PR
needs: [publish-docs]
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const script = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/pr-comment.js`);
await script({github, context});
github-token: ${{ secrets.GITHUB_TOKEN }}