Publish Docs #68
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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@v5 | |
| with: | |
| path: ./galileo-python | |
| - name: Check out Docs repo | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: rungalileo/docs-official | |
| path: ./docs-official | |
| token: ${{ secrets.GALILEO_AUTOMATION_GITHUB_TOKEN }} | |
| # Install Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.11 | |
| # Install docstring_parser | |
| - name: Install Docstring Parser | |
| run: pip install docstring-parser>=0.17.0 | |
| # Build the docs using our script | |
| - name: Build Docs | |
| working-directory: ./galileo-python | |
| run: | | |
| python ./scripts/create_docs.py | |
| # Create a branch in the docs-official repo using the current branch name and the current date | |
| - name: Create a branch | |
| working-directory: ./docs-official | |
| run: git checkout -b feat/update-docs-${GITHUB_REF_NAME}-${{ github.run_id }} | |
| # 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 | |
| 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}-${{ github.run_id }}" | |
| git push -u origin feat/update-docs-${GITHUB_REF_NAME}-${{ github.run_id }} | |
| # Create a PR against the docs repo with the new changes | |
| - name: Create PR | |
| working-directory: ./docs-official | |
| env: | |
| GH_TOKEN: ${{ secrets.GALILEO_AUTOMATION_GITHUB_TOKEN }} | |
| PR_BODY: | | |
| This PR contains the latest updates to the Python SDK documentation. | |
| The SDK doc generation will not change the docs.json for new or removed files, so you will need to manually commit a change to this PR for any file changes. | |
| When reviewing this PR, please do the following: | |
| - [ ] If there are any new files added by the PR, add them to the docs.json file in the right location | |
| - [ ] If there are any files removed by the PR, remove them from the docs.json | |
| - [ ] Launch the docs and check for any file path errors | |
| - [ ] If any SDK docs are removed, check why - this should not happen. If the docstrings are wrong they should be fixed, not removed | |
| - [ ] For added docs, check they are correct (e.g. match the function signature) | |
| **DO NOT** approve this PR until you have completed these checks. | |
| run: | | |
| gh pr create --title "Updated Python SDK docs" --body "${{ env.PR_BODY }}" |