Skip to content

Commit dff6abc

Browse files
committed
Update build-doc.yml
1 parent 1d05f5d commit dff6abc

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.github/workflows/build-doc.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,20 @@ jobs:
2626
run: |
2727
cd doc
2828
uv venv
29+
source .venv/bin/activate
2930
uv pip install -r requirements.txt
3031
3132
- name: Install plotly in editable mode
3233
if: github.ref_name != 'doc-prod'
3334
run: |
3435
cd doc
36+
source .venv/bin/activate
3537
uv pip install -e ..
3638
3739
- name: List installed packages
3840
run: |
3941
cd doc
42+
source .venv/bin/activate
4043
uv pip list
4144
4245
- name: Build HTML docs
@@ -65,6 +68,7 @@ jobs:
6568
path: doc/build/ipynb/
6669

6770
- name: Build API docs
71+
if: github.ref_name == 'migrate-to-gh-actions' && github.event_name == 'push'
6872
run: |
6973
cd doc
7074
source .venv/bin/activate
@@ -77,7 +81,96 @@ jobs:
7781
make html
7882
7983
- name: Upload API docs artifact
84+
if: github.ref_name == 'migrate-to-gh-actions' && github.event_name == 'push'
8085
uses: actions/upload-artifact@v4
8186
with:
8287
name: apidoc-build
8388
path: doc/apidoc/_build/html/
89+
90+
# Deploy steps — currently using test branches for validation
91+
# TODO: Change branch trigger to 'doc-prod' and deploy branches to 'built', 'built_ipynb', 'gh-pages'
92+
- name: Create GitHub App token
93+
if: github.ref_name == 'migrate-to-gh-actions' && github.event_name == 'push'
94+
uses: actions/create-github-app-token@v2
95+
id: app-token
96+
with:
97+
app-id: ${{ vars.GRAPHING_LIBRARIES_CI_GHAPP_ID }}
98+
private-key: ${{ secrets.GRAPHING_LIBRARIES_CI_GHAPP_PRIVATE_KEY }}
99+
owner: ${{ github.repository_owner }}
100+
repositories: plotly.py-docs,graphing-library-docs
101+
102+
- name: Checkout plotly.py-docs (built-test)
103+
if: github.ref_name == 'migrate-to-gh-actions' && github.event_name == 'push'
104+
uses: actions/checkout@v6
105+
with:
106+
repository: plotly/plotly.py-docs
107+
ref: built-test
108+
token: ${{ steps.app-token.outputs.token }}
109+
path: plotly.py-docs-html
110+
111+
- name: Deploy HTML docs
112+
if: github.ref_name == 'migrate-to-gh-actions' && github.event_name == 'push'
113+
run: |
114+
git config --global user.name plotlydocbot
115+
git config --global user.email accounts@plot.ly
116+
rm -rf plotly.py-docs-html/*
117+
cp -r doc/build/html/* plotly.py-docs-html/
118+
cd plotly.py-docs-html
119+
git add .
120+
git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit"
121+
git push --force
122+
123+
- name: Checkout plotly.py-docs (built_ipynb-test)
124+
if: github.ref_name == 'migrate-to-gh-actions' && github.event_name == 'push'
125+
uses: actions/checkout@v6
126+
with:
127+
repository: plotly/plotly.py-docs
128+
ref: built_ipynb-test
129+
token: ${{ steps.app-token.outputs.token }}
130+
path: plotly.py-docs-ipynb
131+
132+
- name: Deploy notebooks
133+
if: github.ref_name == 'migrate-to-gh-actions' && github.event_name == 'push'
134+
run: |
135+
rm -rf plotly.py-docs-ipynb/*
136+
cp -r doc/build/ipynb/* plotly.py-docs-ipynb/
137+
cd plotly.py-docs-ipynb
138+
git add .
139+
git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit"
140+
git push --force
141+
142+
- name: Checkout plotly.py-docs (gh-pages-test)
143+
if: github.ref_name == 'migrate-to-gh-actions' && github.event_name == 'push'
144+
uses: actions/checkout@v6
145+
with:
146+
repository: plotly/plotly.py-docs
147+
ref: gh-pages-test
148+
token: ${{ steps.app-token.outputs.token }}
149+
path: plotly.py-docs-api
150+
151+
- name: Deploy API docs
152+
if: github.ref_name == 'migrate-to-gh-actions' && github.event_name == 'push'
153+
run: |
154+
rm -rf plotly.py-docs-api/*
155+
cp -r doc/apidoc/_build/html/* plotly.py-docs-api/
156+
touch plotly.py-docs-api/.nojekyll
157+
cd plotly.py-docs-api
158+
git add .
159+
git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit"
160+
git push --force
161+
162+
- name: Checkout graphing-library-docs
163+
if: github.ref_name == 'migrate-to-gh-actions' && github.event_name == 'push'
164+
uses: actions/checkout@v6
165+
with:
166+
repository: plotly/graphing-library-docs
167+
ref: test-trigger
168+
token: ${{ steps.app-token.outputs.token }}
169+
path: graphing-library-docs
170+
171+
- name: Trigger downstream doc build
172+
if: github.ref_name == 'migrate-to-gh-actions' && github.event_name == 'push'
173+
run: |
174+
cd graphing-library-docs
175+
git commit --allow-empty -m "deploying https://github.com/plotly/plotly.py/commit/${{ github.sha }}"
176+
git push

0 commit comments

Comments
 (0)