Skip to content

Commit 334605d

Browse files
committed
Restore livedoc
1 parent 85c8f1e commit 334605d

File tree

2 files changed

+95
-95
lines changed

2 files changed

+95
-95
lines changed

.github/workflows/doc-build.yml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
path: ~/conda_pkgs_dir
4545
key:
4646
${{ runner.os }}-conda-${{ hashFiles('environment-${{ env.PYTHON_VERSION }}-linux.yml') }}
47-
47+
4848
- name: Compiler cache
4949
uses: hendrikmuhs/[email protected]
5050
with:
@@ -62,7 +62,7 @@ jobs:
6262
channel-priority: true
6363
activate-environment: sage-dev
6464
environment-file: environment-${{ env.PYTHON_VERSION }}-linux.yml
65-
65+
6666
- name: Build Sage
6767
shell: bash -l {0}
6868
run: |
@@ -74,6 +74,7 @@ jobs:
7474
#
7575
# For pull requests
7676
#
77+
7778
- name: Get workflow run-id
7879
if: github.event_name == 'pull_request'
7980
run: |
@@ -204,33 +205,32 @@ jobs:
204205
name: doc-${{ github.ref_name }}
205206
path: doc.zip
206207

207-
# The following fails randomly
208-
# - name: Build live doc
209-
# if: github.event_name != 'pull_request'
210-
# shell: bash -l {0}
211-
# run: |
212-
# # Remove previous doc build
213-
# rm -rf builddir/src/doc
214-
# meson compile -C builddir doc-html
215-
# env:
216-
# SAGE_USE_CDNS: yes
217-
# SAGE_LIVE_DOC: yes
218-
# SAGE_JUPYTER_SERVER: binder:sagemath/sage-binder-env/dev
219-
# SAGE_DOCBUILD_OPTS: "--include-tests-blocks"
220-
221-
# - name: Copy live doc
222-
# if: github.event_name != 'pull_request'
223-
# run: |
224-
# mkdir -p ./livedoc
225-
# # We copy everything to a local folder
226-
# cp -r builddir/src/doc/html livedoc/
227-
# cp builddir/src/doc/index.html livedoc/
228-
# zip -r livedoc.zip livedoc
229-
230-
# - name: Upload live doc
231-
# if: github.event_name != 'pull_request'
232-
# uses: actions/upload-artifact@v4
233-
# with:
234-
# name: livedoc
235-
# path: livedoc.zip
208+
- name: Build live doc
209+
if: github.event_name != 'pull_request'
210+
shell: bash -l {0}
211+
run: |
212+
# Remove previous doc build
213+
rm -rf builddir/src/doc
214+
meson compile -C builddir doc-html -j1
215+
env:
216+
SAGE_USE_CDNS: yes
217+
SAGE_LIVE_DOC: yes
218+
SAGE_JUPYTER_SERVER: binder:sagemath/sage-binder-env/dev
219+
SAGE_DOCBUILD_OPTS: "--include-tests-blocks"
220+
221+
- name: Copy live doc
222+
if: github.event_name != 'pull_request'
223+
run: |
224+
mkdir -p ./livedoc
225+
# We copy everything to a local folder
226+
cp -r builddir/src/doc/html livedoc/
227+
cp builddir/src/doc/index.html livedoc/
228+
zip -r livedoc.zip livedoc
229+
230+
- name: Upload live doc
231+
if: github.event_name != 'pull_request'
232+
uses: actions/upload-artifact@v4
233+
with:
234+
name: livedoc
235+
path: livedoc.zip
236236

.github/workflows/doc-publish.yml

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -100,67 +100,67 @@ jobs:
100100
echo "::notice::The documentation has been deployed - ${{ steps.deploy-netlify.outputs.NETLIFY_URL }}"
101101
if: steps.download-doc.outcome == 'success'
102102

103-
# publish-live-doc:
104-
# runs-on: ubuntu-latest
105-
# if: github.event.workflow_run.conclusion == 'success'
106-
# env:
107-
# CAN_DEPLOY: ${{ secrets.NETLIFY_AUTH_TOKEN != '' && secrets.NETLIFY_SITE_ID != '' }}
108-
# steps:
109-
# - name: Get information about workflow origin
110-
# uses: potiuk/get-workflow-origin@v1_5
111-
# id: source-run-info
112-
# with:
113-
# token: ${{ secrets.GITHUB_TOKEN }}
114-
# sourceRunId: ${{ github.event.workflow_run.id }}
115-
# if: env.CAN_DEPLOY == 'true'
116-
117-
# - name: Download live doc
118-
# id: download-doc
119-
# uses: actions/download-artifact@v4
120-
# with:
121-
# name: livedoc
122-
# github-token: ${{ secrets.GITHUB_TOKEN }}
123-
# repository: ${{ github.repository }}
124-
# run-id: ${{ github.event.workflow_run.id }}
125-
# # if the doc was built for tag push (targetBranch contains the tag)
126-
# if: steps.source-run-info.outputs.sourceEvent == 'push' && steps.source-run-info.outputs.targetBranch != 'develop'
127-
128-
# - name: Extract live doc
129-
# run: unzip livedoc.zip -d livedoc
130-
# if: steps.download-doc.outcome == 'success'
131-
132-
# - name: Create _headers file for permissive CORS
133-
# run: |
134-
# cat <<EOF > livedoc/livedoc/_headers
135-
# /*
136-
# Access-Control-Allow-Origin: *
137-
# Access-Control-Allow-Methods: GET
138-
# Access-Control-Allow-Headers: Content-Type
139-
# EOF
140-
# if: steps.download-doc.outcome == 'success'
141-
142-
# - name: Deploy to netlify with doc-TAG alias
143-
# id: deploy-netlify
144-
# uses: netlify/actions/cli@master
145-
# with:
146-
# args: deploy --dir=livedoc/livedoc --message ${NETLIFY_MESSAGE} --alias ${NETLIFY_ALIAS}
147-
# env:
148-
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
149-
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
150-
# NETLIFY_MESSAGE: doc-${{ steps.source-run-info.outputs.targetBranch }}
151-
# NETLIFY_ALIAS: doc-${{ steps.source-run-info.outputs.targetBranch }}
152-
# if: steps.download-doc.outcome == 'success'
153-
154-
# - name: Deploy to netlify with doc-release alias
155-
# uses: netlify/actions/cli@master
156-
# with:
157-
# args: deploy --dir=livedoc/livedoc --message doc-release --alias doc-release
158-
# env:
159-
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
160-
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
161-
# if: steps.download-doc.outcome == 'success'
162-
163-
# - name: Report deployment url
164-
# run: |
165-
# echo "::notice::The live documentation has been deployed - ${{ steps.deploy-netlify.outputs.NETLIFY_URL }}"
166-
# if: steps.download-doc.outcome == 'success'
103+
publish-live-doc:
104+
runs-on: ubuntu-latest
105+
if: github.event.workflow_run.conclusion == 'success'
106+
env:
107+
CAN_DEPLOY: ${{ secrets.NETLIFY_AUTH_TOKEN != '' && secrets.NETLIFY_SITE_ID != '' }}
108+
steps:
109+
- name: Get information about workflow origin
110+
uses: potiuk/get-workflow-origin@v1_5
111+
id: source-run-info
112+
with:
113+
token: ${{ secrets.GITHUB_TOKEN }}
114+
sourceRunId: ${{ github.event.workflow_run.id }}
115+
if: env.CAN_DEPLOY == 'true'
116+
117+
- name: Download live doc
118+
id: download-doc
119+
uses: actions/download-artifact@v4
120+
with:
121+
name: livedoc
122+
github-token: ${{ secrets.GITHUB_TOKEN }}
123+
repository: ${{ github.repository }}
124+
run-id: ${{ github.event.workflow_run.id }}
125+
# if the doc was built for tag push (targetBranch contains the tag)
126+
if: steps.source-run-info.outputs.sourceEvent == 'push' && steps.source-run-info.outputs.targetBranch != 'develop'
127+
128+
- name: Extract live doc
129+
run: unzip livedoc.zip -d livedoc
130+
if: steps.download-doc.outcome == 'success'
131+
132+
- name: Create _headers file for permissive CORS
133+
run: |
134+
cat <<EOF > livedoc/livedoc/_headers
135+
/*
136+
Access-Control-Allow-Origin: *
137+
Access-Control-Allow-Methods: GET
138+
Access-Control-Allow-Headers: Content-Type
139+
EOF
140+
if: steps.download-doc.outcome == 'success'
141+
142+
- name: Deploy to netlify with doc-TAG alias
143+
id: deploy-netlify
144+
uses: netlify/actions/cli@master
145+
with:
146+
args: deploy --dir=livedoc/livedoc --message ${NETLIFY_MESSAGE} --alias ${NETLIFY_ALIAS}
147+
env:
148+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
149+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
150+
NETLIFY_MESSAGE: doc-${{ steps.source-run-info.outputs.targetBranch }}
151+
NETLIFY_ALIAS: doc-${{ steps.source-run-info.outputs.targetBranch }}
152+
if: steps.download-doc.outcome == 'success'
153+
154+
- name: Deploy to netlify with doc-release alias
155+
uses: netlify/actions/cli@master
156+
with:
157+
args: deploy --dir=livedoc/livedoc --message doc-release --alias doc-release
158+
env:
159+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
160+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
161+
if: steps.download-doc.outcome == 'success'
162+
163+
- name: Report deployment url
164+
run: |
165+
echo "::notice::The live documentation has been deployed - ${{ steps.deploy-netlify.outputs.NETLIFY_URL }}"
166+
if: steps.download-doc.outcome == 'success'

0 commit comments

Comments
 (0)