Skip to content

Publish Docs

Publish Docs #26

Workflow file for this run

# Publishes SDK docs to the docs-official repo (https://github.com/rungalileo/docs-official)
name: Publish Docs
on:
workflow_dispatch:
workflow_run:
workflows: ["Package Release"]
types:
- completed
jobs:
publish-docs:
runs-on: ubuntu-latest
steps:
# Checkout both this repo, and the docs official repo
- name: Checkout
uses: actions/checkout@v4
with:
path: ./galileo-python
- name: Check out Docs repo
uses: actions/checkout@v4
with:
repository: rungalileo/docs-official
path: ./docs-official
# Install the GitHub CLI - this is needed to create a pull request against the docs
- name: Install GH Cli
run: |
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
# Install Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
# Install pydoc-markdown to generate the documentation
- name: Install PyDoc
run: pipx install pydoc-markdown
# Generate the docs using PyDoc
# Then convert from md to mdx, and do some other tweaks to make them work with our docs
- name: Build Docs
working-directory: ./galileo-python
run: |
pydoc-markdown
python ./scripts/convert-md-to-mdx.py
# Create a branch in the docs-official repo using the current branch name
- name: Create a branch
working-directory: ./docs-official
run: git checkout -b feat/update-docs-${GITHUB_REF_NAME}
# Copy the generated docs from the Python SDK repo to the docs repo
- name: Update SDK docs
run: |
rm -rf ./docs-official/sdk-api/python/reference
rm ./galileo-python/.generated_docs/reference/sidebar.json
cp -r ./galileo-python/.generated_docs/reference ./docs-official/sdk-api/python/
# Commit the changes to the branch, and push
- name: Commit changes
working-directory: ./docs-official
run: |
git config --global user.email "info@galileo.com"
git config --global user.name "Galileo"
git add .
git commit -m "Updating docs from ${GITHUB_REF_NAME}"
git push -u origin feat/update-docs-${GITHUB_REF_NAME}
# Create a PR against the docs repo with the new changes
- name: Create PR
working-directory: ./docs-official
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr create --title "Updated SDK docs" --body "Autogenerated update to SDK docs"