Skip to content

Manual Publish Docs #18

Manual Publish Docs

Manual Publish Docs #18

name: Manual Publish Docs
on:
workflow_dispatch:
inputs:
workspace_path:
description: 'Path to the workspace being released.'
required: true
type: choice
options:
- sdk/highlight-run
- 'sdk/@launchdarkly/observability-node'
- 'sdk/@launchdarkly/observability-python'
workflow_call:
inputs:
workspace_path:
description: 'Path to the workspace being released.'
required: true
type: string
permissions:
contents: write
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
publish-docs:
runs-on: ubuntu-22.04-8core-32gb
steps:
- name: Checkout
uses: actions/checkout@v4
- run: git submodule update --init --recursive
- name: Check if JS package
id: check-js-package
run: |
if ./scripts/is-js-package.sh ${{ inputs.workspace_path }}; then
echo "is_js_package=true" >> $GITHUB_OUTPUT
else
echo "is_js_package=false" >> $GITHUB_OUTPUT
fi
- name: Setup Node.js environment
if: ${{ steps.check-js-package.outputs.is_js_package == 'true' }}
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'yarn'
- name: Install js dependencies
if: ${{ steps.check-js-package.outputs.is_js_package == 'true' }}
run: yarn install --mode=skip-build
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
- name: 'Set WORKSPACE_NAME variable'
if: ${{ steps.check-js-package.outputs.is_js_package == 'true' }}
shell: bash
run: |
WORKSPACE_NAME=$(./scripts/package-name.sh ${{ inputs.workspace_path }})
echo "WORKSPACE_NAME=$WORKSPACE_NAME" >> $GITHUB_ENV
- name: Build JS package docs
if: ${{ steps.check-js-package.outputs.is_js_package == 'true' }}
run: yarn docs --filter ${{ env.WORKSPACE_NAME }}
- name: Make Install
if: ${{ steps.check-js-package.outputs.is_js_package == 'false' }}
run: |
cd ${{ inputs.workspace_path }}
make install
- name: Build Makefile Docs
# Assume non-js projects will use a Makefile to build docs.
if: ${{ steps.check-js-package.outputs.is_js_package == 'false' }}
run: |
cd ${{ inputs.workspace_path }}
make docs
- name: Publish Highlight.run as Observability Plugin
if: inputs.workspace_path == 'sdk/highlight-run'
uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.2
with:
docs_path: sdk/highlight-run/docs
output_path: packages/@launchdarkly/observability
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Docs
# This is generalized to work with any package, but we don't use it for highlight-run,
# because we publish its docs to a different path.
if: inputs.workspace_path != 'sdk/highlight-run'
uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.2
with:
docs_path: ${{ inputs.workspace_path }}/docs
output_path: ${{ inputs.workspace_path }}
github_token: ${{ secrets.GITHUB_TOKEN }}