-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
161 lines (141 loc) · 6.09 KB
/
Copy pathbuild-doc.yml
File metadata and controls
161 lines (141 loc) · 6.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Build Documentation
on:
push:
branches:
- doc-prod
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: read
jobs:
build-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
python-version: "3.9"
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install rename
- name: Install doc dependencies
run: |
cd doc
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt
- name: Install plotly in editable mode
if: github.ref_name != 'doc-prod'
run: |
cd doc
source .venv/bin/activate
uv pip uninstall plotly
uv pip install -e ..
- name: Build HTML docs
run: |
cd doc
source .venv/bin/activate
make -kj8 || make -kj8
# Fetch scripts from plotly/graphing-library-docs, pinned to a specific commit SHA
# to guard against unauthorized changes in that repo. If changes are made to the
# below-referenced scripts in plotly/graphing-library-docs, update DOCS_CI_REF
# accordingly to point to the latest commit SHA.
DOCS_CI_REF=e05eaed1ae800139df084e0587762aa273a4f19d
curl -fsSL https://raw.githubusercontent.com/plotly/graphing-library-docs/$DOCS_CI_REF/front-matter-ci.py > front-matter-ci.py
curl -fsSL https://raw.githubusercontent.com/plotly/graphing-library-docs/$DOCS_CI_REF/check-or-enforce-order.py > check-or-enforce-order.py
python front-matter-ci.py build/html
python check-or-enforce-order.py build/html
- name: Upload HTML docs artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: doc-html
path: doc/build/html/
- name: Create GitHub App token
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: app-token
with:
app-id: ${{ vars.GRAPHING_LIBRARIES_CI_GHAPP_ID }}
private-key: ${{ secrets.GRAPHING_LIBRARIES_CI_GHAPP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: plotly.py-docs,graphing-library-docs
- name: Checkout plotly.py-docs (built)
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: plotly/plotly.py-docs
ref: built
token: ${{ steps.app-token.outputs.token }}
path: plotly.py-docs-html
- name: Deploy HTML docs
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
run: |
git config --global user.name plotlydocbot
git config --global user.email accounts@plot.ly
rm -rf plotly.py-docs-html/*
cp -r doc/build/html/* plotly.py-docs-html/
cd plotly.py-docs-html
git add .
git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit"
git push --force
- name: Checkout plotly.py-docs (built_ipynb)
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: plotly/plotly.py-docs
ref: built_ipynb
token: ${{ steps.app-token.outputs.token }}
path: plotly.py-docs-ipynb
- name: Deploy notebooks
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
run: |
rm -rf plotly.py-docs-ipynb/*
cp -r doc/build/ipynb/* plotly.py-docs-ipynb/
cd plotly.py-docs-ipynb
git add .
git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit"
git push --force
- name: Checkout graphing-library-docs
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: plotly/graphing-library-docs
ref: master
token: ${{ steps.app-token.outputs.token }}
path: graphing-library-docs
- name: Trigger downstream doc build
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
run: |
cd graphing-library-docs
git commit --allow-empty -m "deploying https://github.com/plotly/plotly.py/commit/${{ github.sha }}"
git push
- name: Build API docs
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
run: |
cd doc
source .venv/bin/activate
# For the API doc, we need to use the local version of plotly
# since we are tweaking the source because of
# graph_objs/graph_objects
uv pip uninstall plotly
uv pip install -e ..
cd apidoc
make html
- name: Checkout plotly.py-docs (gh-pages)
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: plotly/plotly.py-docs
ref: gh-pages
token: ${{ steps.app-token.outputs.token }}
path: plotly.py-docs-api
- name: Deploy API docs
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
run: |
rm -rf plotly.py-docs-api/*
cp -r doc/apidoc/_build/html/* plotly.py-docs-api/
touch plotly.py-docs-api/.nojekyll
cd plotly.py-docs-api
git add .
git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit"
git push --force