Skip to content

Commit 636c96c

Browse files
author
Release Manager
committed
gh-36636: Deploy live doc on push to develop <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> Live doc is built separately from the usual doc preview on push to `develop`, and deployed to Netlify. Sample deployment: https://deploy-livedoc-- sagemath.netlify.app/html/en/a_tour_of_sage/ <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> - #36601 <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36636 Reported by: Kwankyu Lee Reviewer(s): Kwankyu Lee, Matthias Köppe
2 parents d1da6ba + 009d033 commit 636c96c

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

.github/workflows/doc-build.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,36 @@ jobs:
197197
with:
198198
name: docs
199199
path: docs.zip
200+
201+
- name: Build live doc
202+
id: buildlivedoc
203+
if: (success() || failure()) && steps.copy.outcome == 'success' && github.repository == 'sagemath/sage' && github.ref == 'refs/heads/develop'
204+
run: |
205+
set -ex
206+
export SAGE_USE_CDNS=yes
207+
export SAGE_LIVE_DOC=yes
208+
export SAGE_JUPYTER_SERVER=binder:sagemath/sage-binder-env/dev
209+
make doc-clean doc-uninstall
210+
./config.status && make sagemath_doc_html-no-deps
211+
working-directory: ./worktree-image
212+
env:
213+
MAKE: make -j2 --output-sync=recurse
214+
SAGE_NUM_THREADS: 2
215+
216+
- name: Copy live doc
217+
id: copylivedoc
218+
if: (success() || failure()) && steps.buildlivedoc.outcome == 'success'
219+
run: |
220+
set -ex
221+
mkdir -p ./livedoc
222+
cp -r -L /sage/local/share/doc/sage/html ./livedoc
223+
cp /sage/local/share/doc/sage/index.html ./livedoc
224+
zip -r livedoc.zip livedoc
225+
226+
- name: Upload live doc
227+
if: (success() || failure()) && steps.copylivedoc.outcome == 'success'
228+
uses: actions/upload-artifact@v3
229+
with:
230+
name: livedoc
231+
path: livedoc.zip
232+

.github/workflows/doc-publish.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,48 @@ jobs:
9090

9191
- name: Report deployment url
9292
run: |
93-
echo "::notice::The documentation has being automatically deployed to Netlify. %0A ✅ Preview: ${{ steps.deploy-netlify.outputs.NETLIFY_URL }}"
93+
echo "::notice::The documentation has been deployed - ${{ steps.deploy-netlify.outputs.NETLIFY_URL }}"
94+
95+
publish-live-doc:
96+
runs-on: ubuntu-latest
97+
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'develop'
98+
steps:
99+
- name: Download live doc
100+
uses: actions/[email protected]
101+
with:
102+
script: |
103+
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
104+
owner: context.repo.owner,
105+
repo: context.repo.repo,
106+
run_id: ${{github.event.workflow_run.id }},
107+
});
108+
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
109+
return artifact.name == "livedoc"
110+
})[0];
111+
var download = await github.rest.actions.downloadArtifact({
112+
owner: context.repo.owner,
113+
repo: context.repo.repo,
114+
artifact_id: matchArtifact.id,
115+
archive_format: 'zip',
116+
});
117+
var fs = require('fs');
118+
fs.writeFileSync('${{github.workspace}}/livedoc.zip', Buffer.from(download.data));
119+
120+
- name: Extract live doc
121+
run: unzip livedoc.zip -d doc && unzip doc/livedoc.zip -d doc/doc
122+
123+
- name: Deploy to Netlify
124+
id: deploy-netlify
125+
uses: netlify/actions/cli@master
126+
with:
127+
args: deploy --dir=doc/doc/livedoc --message ${NETLIFY_MESSAGE} --alias ${NETLIFY_ALIAS}
128+
env:
129+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
130+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
131+
NETLIFY_MESSAGE: Deployed live doc
132+
NETLIFY_ALIAS: deploy-livedoc
133+
134+
- name: Report deployment url
135+
run: |
136+
echo "::notice::The live documentation has been deployed - ${{ steps.deploy-netlify.outputs.NETLIFY_URL }}"
94137

0 commit comments

Comments
 (0)