Skip to content

Commit 9d62446

Browse files
author
Release Manager
committed
sagemathgh-40586: Revive doc-release On every release, "doc-release" (full sage documentation with live examples and pdf docs) had been published. That was broken by sagemath#40379. The up-to-date doc-release was available through the Documentation section of the [Wiki](https://github.com/sagemath/sage/wiki). Currently available doc-release was manually uploaded by me. By the way, "doc-release" is also essential for "other version" selector (see below the Sage logo on the left panel) to work. It is currently broken. Note that "doc-release" is the source of "other versions" info. See https://doc-release--sagemath.netlify.app/html/en/versions.txt. Now doc-release is built in the doc-build-pdf workflow, and published in the new doc-publish-pdf workflow, separated from the doc-publish workflow. Test run: doc-build-livedoc: https://github.com/kwankyu/sage/actions/runs/17295972262 doc-publish-livedoc: https://github.com/kwankyu/sage/actions/runs/17298223187 Deployed doc-release: https://doc-release--sagemath-test.netlify.app/html/en/reference/ (currently broken in meson build of live doc) Try "Sage Live" tabs at https://doc-release--sagemath- test.netlify.app/html/en/reference/plot3d/sage/plot/plot3d/plot3d Fixes sagemath#40463. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40586 Reported by: Kwankyu Lee Reviewer(s): Dima Pasechnik, Kwankyu Lee, user202729
2 parents dbd778e + 9c023fb commit 9d62446

File tree

5 files changed

+195
-120
lines changed

5 files changed

+195
-120
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Build live documentation
2+
3+
on:
4+
push:
5+
tags:
6+
# Match all release tags including beta, rc
7+
- '[0-9]+.[0-9]+'
8+
- '[0-9]+.[0-9]+.[0-9]+'
9+
- '[0-9]+.[0-9]+.beta[0-9]+'
10+
- '[0-9]+.[0-9]+.[0-9]+.beta[0-9]+'
11+
- '[0-9]+.[0-9]+.rc[0-9]+'
12+
- '[0-9]+.[0-9]+.[0-9]+.rc[0-9]+'
13+
workflow_dispatch:
14+
15+
env:
16+
PYTHON_VERSION: 3.11
17+
18+
jobs:
19+
livedoc:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Cache conda packages
26+
uses: actions/cache@v4
27+
with:
28+
path: ~/conda_pkgs_dir
29+
key:
30+
${{ runner.os }}-conda-${{ hashFiles('environment-${{ env.PYTHON_VERSION }}-linux.yml') }}
31+
32+
- name: Compiler cache
33+
uses: hendrikmuhs/[email protected]
34+
with:
35+
key: ${{ runner.os }}-meson-${{ env.PYTHON_VERSION }}
36+
37+
- name: Setup Conda environment
38+
uses: conda-incubator/setup-miniconda@v3
39+
with:
40+
python-version: ${{ env.PYTHON_VERSION }}
41+
# Disabled for now due to
42+
# https://github.com/conda-incubator/setup-miniconda/issues/379
43+
# miniforge-version: latest
44+
use-mamba: true
45+
channels: conda-forge
46+
channel-priority: true
47+
activate-environment: sage-dev
48+
environment-file: environment-${{ env.PYTHON_VERSION }}-linux.yml
49+
50+
- name: Build Sage
51+
shell: bash -l {0}
52+
run: |
53+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
54+
export CC="ccache $CC"
55+
export CXX="ccache $CXX"
56+
pip install --no-build-isolation --config-settings=builddir=builddir . -v
57+
58+
- name: Build pdf doc
59+
shell: bash -l {0}
60+
run: |
61+
sudo DEBIAN_FRONTEND=noninteractive sudo apt-get update
62+
sudo DEBIAN_FRONTEND=noninteractive apt-get install $(build/bin/sage-get-system-packages debian texlive texlive_luatex free_fonts xindy)
63+
meson compile -C builddir doc-pdf
64+
65+
- name: Build live doc
66+
shell: bash -l {0}
67+
run: |
68+
meson compile -C builddir doc-html -j1
69+
env:
70+
SAGE_USE_CDNS: yes
71+
SAGE_LIVE_DOC: yes
72+
SAGE_JUPYTER_SERVER: "binder:sagemath/sage-binder-env/dev"
73+
74+
- name: Copy doc
75+
id: copy
76+
run: |
77+
mkdir -p ./doc
78+
cp -r builddir/src/doc/pdf doc/
79+
cp -rL builddir/src/doc/html doc/
80+
cp builddir/src/doc/index.html doc/
81+
zip -r livedoc.zip doc
82+
83+
- name: Upload livedoc
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: livedoc
87+
path: livedoc.zip

.github/workflows/doc-build-pdf.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ on:
44
pull_request:
55
merge_group:
66
push:
7-
tags:
8-
# Match all release tags including beta, rc
9-
- '[0-9]+.[0-9]+'
10-
- '[0-9]+.[0-9]+.[0-9]+'
11-
- '[0-9]+.[0-9]+.beta[0-9]+'
12-
- '[0-9]+.[0-9]+.[0-9]+.beta[0-9]+'
13-
- '[0-9]+.[0-9]+.rc[0-9]+'
14-
- '[0-9]+.[0-9]+.[0-9]+.rc[0-9]+'
157
branches:
168
- develop
179
workflow_dispatch:
@@ -44,7 +36,7 @@ jobs:
4436
path: ~/conda_pkgs_dir
4537
key:
4638
${{ runner.os }}-conda-${{ hashFiles('environment-${{ env.PYTHON_VERSION }}-linux.yml') }}
47-
39+
4840
- name: Compiler cache
4941
uses: hendrikmuhs/[email protected]
5042
with:
@@ -62,7 +54,7 @@ jobs:
6254
channel-priority: true
6355
activate-environment: sage-dev
6456
environment-file: environment-${{ env.PYTHON_VERSION }}-linux.yml
65-
57+
6658
- name: Build Sage
6759
shell: bash -l {0}
6860
run: |

.github/workflows/doc-build.yml

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ on:
44
pull_request:
55
merge_group:
66
push:
7-
tags:
8-
# Match all release tags including beta, rc
9-
- '[0-9]+.[0-9]+'
10-
- '[0-9]+.[0-9]+.[0-9]+'
11-
- '[0-9]+.[0-9]+.beta[0-9]+'
12-
- '[0-9]+.[0-9]+.[0-9]+.beta[0-9]+'
13-
- '[0-9]+.[0-9]+.rc[0-9]+'
14-
- '[0-9]+.[0-9]+.[0-9]+.rc[0-9]+'
157
branches:
168
- develop
179
workflow_dispatch:
@@ -74,6 +66,7 @@ jobs:
7466
#
7567
# For pull requests
7668
#
69+
7770
- name: Get workflow run-id
7871
if: github.event_name == 'pull_request'
7972
run: |
@@ -195,7 +188,7 @@ jobs:
195188
path: doc.zip
196189

197190
#
198-
# On release events
191+
# On push events
199192
#
200193

201194
- name: Upload doc-develop
@@ -205,34 +198,3 @@ jobs:
205198
with:
206199
name: doc-${{ github.ref_name }}
207200
path: doc.zip
208-
209-
# The following fails randomly
210-
# - name: Build live doc
211-
# if: github.event_name != 'pull_request'
212-
# shell: bash -l {0}
213-
# run: |
214-
# # Remove previous doc build
215-
# rm -rf builddir/src/doc
216-
# meson compile -C builddir doc-html
217-
# env:
218-
# SAGE_USE_CDNS: yes
219-
# SAGE_LIVE_DOC: yes
220-
# SAGE_JUPYTER_SERVER: binder:sagemath/sage-binder-env/dev
221-
# SAGE_DOCBUILD_OPTS: "--include-tests-blocks"
222-
223-
# - name: Copy live doc
224-
# if: github.event_name != 'pull_request'
225-
# run: |
226-
# mkdir -p ./livedoc
227-
# # We copy everything to a local folder
228-
# cp -r builddir/src/doc/html livedoc/
229-
# cp builddir/src/doc/index.html livedoc/
230-
# zip -r livedoc.zip livedoc
231-
232-
# - name: Upload live doc
233-
# if: github.event_name != 'pull_request'
234-
# uses: actions/upload-artifact@v4
235-
# with:
236-
# name: livedoc
237-
# path: livedoc.zip
238-
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Publish live documentation
2+
3+
on:
4+
workflow_run:
5+
workflows: "Build live documentation"
6+
types:
7+
- completed
8+
9+
permissions:
10+
statuses: write
11+
checks: write
12+
pull-requests: write
13+
14+
15+
# This workflow runs after doc-build-livedoc workflow, taking the
16+
# artifact livedoc and deploying it to a netlify site.
17+
#
18+
# event (triggered doc-build-livedoc) URL (of the doc deployed to NETLIFY_SITE)
19+
# ----------------------------------- ---------------------------------
20+
# on push tag https://doc-10-4-beta2--NETLIFY_SITE
21+
# on push tag https://doc-release--NETLIFY_SITE
22+
#
23+
# where NETLIFY_SITE is presently sagemath.netlify.app for repo sagemath/sage.
24+
#
25+
# This workflow runs only if secrets NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID are set.
26+
27+
jobs:
28+
publish-live-doc:
29+
runs-on: ubuntu-latest
30+
if: github.event.workflow_run.conclusion == 'success'
31+
env:
32+
CAN_DEPLOY: ${{ secrets.NETLIFY_AUTH_TOKEN != '' && secrets.NETLIFY_SITE_ID != '' }}
33+
steps:
34+
- name: Get information about workflow origin
35+
uses: actions/github-script@v6
36+
id: source-run-info
37+
with:
38+
script: |
39+
const runId = context.payload.workflow_run.id;
40+
const { data: run } = await github.rest.actions.getWorkflowRun({
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
run_id: runId
44+
});
45+
const event = run.event;
46+
const branchName = run.head_branch;
47+
48+
core.setOutput('sourceEvent', event);
49+
core.setOutput('branchName', branchName);
50+
if: env.CAN_DEPLOY == 'true'
51+
52+
- name: Download live doc
53+
id: download-doc
54+
uses: actions/download-artifact@v4
55+
with:
56+
name: livedoc
57+
github-token: ${{ secrets.GITHUB_TOKEN }}
58+
repository: ${{ github.repository }}
59+
run-id: ${{ github.event.workflow_run.id }}
60+
# if the doc was built for tag push (branchName contains the tag)
61+
if: steps.source-run-info.outputs.sourceEvent == 'push' && steps.source-run-info.outputs.branchName != 'develop'
62+
63+
- name: Extract live doc
64+
run: unzip livedoc.zip -d livedoc
65+
if: steps.download-doc.outcome == 'success'
66+
67+
- name: Create _headers file for permissive CORS
68+
run: |
69+
cat <<EOF > livedoc/doc/_headers
70+
/*
71+
Access-Control-Allow-Origin: *
72+
Access-Control-Allow-Methods: GET
73+
Access-Control-Allow-Headers: Content-Type
74+
EOF
75+
if: steps.download-doc.outcome == 'success'
76+
77+
- name: Deploy to netlify with doc-TAG alias
78+
id: deploy-netlify
79+
uses: netlify/actions/cli@master
80+
with:
81+
args: deploy --dir=livedoc/doc --message ${NETLIFY_MESSAGE} --alias ${NETLIFY_ALIAS}
82+
env:
83+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
84+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
85+
NETLIFY_MESSAGE: doc-${{ steps.source-run-info.outputs.branchName }}
86+
NETLIFY_ALIAS: doc-${{ steps.source-run-info.outputs.branchName }}
87+
if: steps.download-doc.outcome == 'success'
88+
89+
- name: Deploy to netlify with doc-release alias
90+
uses: netlify/actions/cli@master
91+
with:
92+
args: deploy --dir=livedoc/doc --message doc-release --alias doc-release
93+
env:
94+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
95+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
96+
if: steps.download-doc.outcome == 'success'
97+
98+
- name: Report deployment url
99+
run: |
100+
echo "::notice::The live documentation has been deployed - ${{ steps.deploy-netlify.outputs.NETLIFY_URL }}"
101+
if: steps.download-doc.outcome == 'success'

.github/workflows/doc-publish.yml

Lines changed: 3 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Publish documentation
22

33
on:
44
workflow_run:
5-
workflows: ["Build documentation"]
5+
workflows: "Build documentation"
66
types:
77
- completed
88

@@ -12,15 +12,13 @@ permissions:
1212
pull-requests: write
1313

1414

15-
# This workflow runs after doc-build workflow, taking the artifact
16-
# (doc/livedoc) and deploying it to a netlify site.
15+
# This workflow runs after doc-build workflow, taking the
16+
# artifact doc and deploying it to a netlify site.
1717
#
1818
# event (triggered doc-build) URL (of the doc deployed to NETLIFY_SITE)
1919
# --------------------------- ---------------------------------
2020
# on pull request https://doc-pr-12345--NETLIFY_SITE
2121
# on push branch develop https://doc-develop--NETLIFY_SITE
22-
# on push tag https://doc-10-4-beta2--NETLIFY_SITE
23-
# on push tag https://doc-release--NETLIFY_SITE
2422
#
2523
# where NETLIFY_SITE is presently sagemath.netlify.app for repo sagemath/sage.
2624
#
@@ -99,68 +97,3 @@ jobs:
9997
run: |
10098
echo "::notice::The documentation has been deployed - ${{ steps.deploy-netlify.outputs.NETLIFY_URL }}"
10199
if: steps.download-doc.outcome == 'success'
102-
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)