1
+ # Publishes SDK docs to the docs-official repo (https://github.com/rungalileo/docs-official)
1
2
name : Publish Docs
2
3
3
4
on :
@@ -12,29 +13,75 @@ jobs:
12
13
runs-on : ubuntu-latest
13
14
14
15
steps :
16
+ # Checkout both this repo, and the docs official repo
15
17
- name : Checkout
16
18
uses : actions/checkout@v4
19
+ with :
20
+ path : ./galileo-python
17
21
18
- - name : Install poetry
19
- run : pipx install poetry==${{ vars.POETRY_VERSION }}
22
+ - name : Check out Docs repo
23
+ uses : actions/checkout@v4
24
+ with :
25
+ repository : rungalileo/docs-official
26
+ path : ./docs-official
27
+ ref : feat/python-docs
28
+
29
+ # Install the GitHub CLI - this is needed to create a pull request against the docs
30
+ - name : Install GH Cli
31
+ run : |
32
+ (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
33
+ && sudo mkdir -p -m 755 /etc/apt/keyrings \
34
+ && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
35
+ && cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
36
+ && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
37
+ && 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 \
38
+ && sudo apt update \
39
+ && sudo apt install gh -y
20
40
41
+ # Install Python
21
42
- name : Set up Python
22
43
uses : actions/setup-python@v5
23
44
with :
24
45
python-version : 3.11
25
- cache : " poetry"
26
- cache-dependency-path : " pyproject.toml"
27
46
47
+ # Install pydoc-markdown to generate the documentation
48
+ - name : Install PyDoc
49
+ run : pipx install pydoc-markdown
50
+
51
+ # Generate the docs using PyDoc
52
+ # Then convert from md to mdx, and do some other tweaks to make them work with our docs
28
53
- name : Build Docs
29
- # Install all dependencies so that the docs can use the function and type signatures.
54
+ working-directory : ./galileo-python
30
55
run : |
31
- pipx install invoke
32
- poetry install --all-extras --without test,dev
33
- invoke docs-build
56
+ pydoc-markdown
57
+ python ./scripts/convert-md-to-mdx.py
58
+
59
+ # Create a branch in the docs-official repo using the current branch name
60
+ - name : Create a branch
61
+ working-directory : ./docs-official
62
+ run : git checkout -b feat/update-docs-${GITHUB_REF_NAME}
63
+
64
+ # Copy the generated docs from the Python SDK repo to the docs repo
65
+ - name : Update SDK docs
66
+ run : |
67
+ rm -rf ./docs-official/sdk-api/python/reference
68
+ cp -r ./galileo-python/.generated_docs/reference ./docs-official/sdk-api/python/
69
+
70
+ # Commit the changes to the branch, and push
71
+ - name : Commit changes
72
+ working-directory : ./docs-official
73
+ run : |
74
+ git config --global user.email "info@galileo.com"
75
+ git config --global user.name "Galileo"
76
+ git add .
77
+ git commit -m "Updating docs from ${GITHUB_REF_NAME}"
78
+ git push -u origin feat/update-docs-${GITHUB_REF_NAME}
79
+
80
+ # Create a PR against the docs repo with the new changes
81
+ - name : Create PR
82
+ working-directory : ./docs-official
83
+ env :
84
+ GH_TOKEN : ${{ github.token }}
85
+ run : |
86
+ gh pr create --title "Updated SDK docs" --body "Autogenerated update to SDK docs"
34
87
35
- - name : Publish Docs
36
- uses : cloudflare/wrangler-action@v3
37
- with :
38
- apiToken : ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }}
39
- accountId : ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
40
- command : pages deploy
0 commit comments