-
-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix doc deployment to netlify for releases #38220
Conversation
Documentation preview for this PR (built with commit b5ec091; changes) is ready! 🎉 |
8cc5a3f
to
21001f6
Compare
In #36730, I have a change that builds the live doc (and only the live doc) on pushed release tags instead of on the "develop" branch. Would you agree with this change? |
No problem. Then this test |
Perhaps I missed the point of your question. Do you mean that with your change, docs (which is not livedoc) will not be uploaded on pushed release tags? |
So with your change, 'https://preview-release--sagemath.netlify.app' (that is 'https://sagemath.netlify.app') won't exist, only 'https://livedoc--sagemath.netlify.app' will. I think I prefer to have 'https://preview-release--sagemath.netlify.app', which is better suited for visual comparison with PR doc preview (which is not livedoc) |
Then let's do this bit, part of the change in #36730? diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml
index 9dfb8d7d221..57058ac8566 100644
--- a/.github/workflows/doc-build.yml
+++ b/.github/workflows/doc-build.yml
@@ -4,6 +4,14 @@ on:
pull_request:
merge_group:
push:
+ tags:
+ # Match all release tags including beta, rc
+ - '[0-9]+.[0-9]+'
+ - '[0-9]+.[0-9]+.[0-9]+'
+ - '[0-9]+.[0-9]+.beta[0-9]+'
+ - '[0-9]+.[0-9]+.[0-9]+.beta[0-9]+'
+ - '[0-9]+.[0-9]+.rc[0-9]+'
+ - '[0-9]+.[0-9]+.[0-9]+.rc[0-9]+'
branches:
- master
- develop
@@ -114,11 +122,13 @@ jobs:
--workdir $(pwd) \
${{ env.BUILD_IMAGE }} /bin/sh
- # Docs
+ #
+ # On PRs and pushes to branches master/develop
+ #
- name: Store old docs
id: worktree
- if: (success() || failure()) && steps.container.outcome == 'success'
+ if: (success() || failure()) && steps.container.outcome == 'success' && !startsWith(github.ref, 'refs/tags/')
run: |
git config --global --add safe.directory $(pwd)
git config --global user.email "[email protected]"
@@ -145,7 +155,7 @@ jobs:
- name: Build docs
id: docbuild
- if: (success() || failure()) && steps.worktree.outcome == 'success'
+ if: (success() || failure()) && steps.worktree.outcome == 'success' && !startsWith(github.ref, 'refs/tags/')
# Always non-incremental because of the concern that
# incremental docbuild may introduce broken links (inter-file references) though build succeeds
run: |
@@ -182,9 +192,13 @@ jobs:
name: docs
path: docs.zip
+ #
+ # On release tags: live doc and wheels
+ #
+
- name: Build live doc
id: buildlivedoc
- if: (success() || failure()) && steps.copy.outcome == 'success' && github.repository == 'sagemath/sage' && github.ref == 'refs/heads/develop'
+ if: (success() || failure()) && steps.container.outcome == 'success' && startsWith(github.ref, 'refs/tags/')
run: |
export MAKE="make -j5 --output-sync=recurse" SAGE_NUM_THREADS=5
export PATH="build/bin:$PATH" |
The change of If |
Not harmful. OK. |
For the tags, can we now arrange for the live doc to be deposited in versioned URLs? |
For comparison purpose with the docs (non-live) for PRs, the regular (non-live) doc would be better. regular doc or live doc for tags? My suggestion: For tags, we may deploy regular doc to |
You mean for preparing the diff, or for something else? The diff is always made against the documentation that is in the container image, and it unrelated to what is deployed to netlify, right? |
Right. But the "changes.html" page uses the deployed netlify doc site for online comparison with the doc for a PR. |
OK, but that's not actually the correct version of the documentation to link, right? The container image is made on pushes to release tags, each of which is also pushed to |
Why not? It is the latest release.
Ah, I see. |
In any case I would suggest to include the word "doc" in all of the URLs because nothing else in the URL explains that it is documentation.
|
Another possibility is to change the domain name from "sagemath.netlify.app" to "sagemath-doc.netlify.app"or "sagedoc.netlify.app" |
"Deploy Documentation" fails (https://github.com/sagemath/sage/actions/runs/9637964820/job/26577952721) naturally because doc-build.yml and doc-publish.yml do not work in harmony here. |
Just because of the upload/download-artifact versions or other changes too? |
I changed all "docs" to "doc" to be consistent with "livedoc". "doc-build.yml" coming from this PR uploads "doc.zip" while "doc-publish.yml" coming from the develop branch downloads "docs.zip". So there is a mismatch. See https://github.com/sagemath/sage/actions/runs/9637964820 Of course, "doc-publish.yml" from this PR will work well. |
a cleaner migration path would be to make doc-publish accept either version |
The friction will just last briefly. Few unfortunate PRs will be affected. Maybe none. I think "cleaner migration path" is unnecessary hassle. |
OK. |
Let's merge it. |
Thanks. Ideally CI should be much more robust than the target software. I expect that with this PR, our doc CI will be robust enough, at least for some time. But there are some warnings that some actions used in our CI will be deprecated soon, which would break CI again... |
Specifically, netlify/actions/cli@master:
This is minor. Perhaps netlify will fix it. potiuk/get-workflow-origin@v1_5:
According to the author, get-workflow-origin is not maintained. So this is more serious. |
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> broken by careless code in sagemath#38213: ``` # Restore the new doc from changes by "wipe out" (cd docs && git checkout -f) ``` which also wipes out anchors planted by `.ci/create-changes-html.sh`! To reviewer: changes over sagemath#38220 is in https://github.com/sagemath/sage/ pull/38274/commits/d2d1514148f46a4ceeea650eab1fd0a0800ebbc9 Tested in : https://github.com/kwankyu/sage/actions/runs/9659812609/job/26643993813. Try to open https://doc-pr-43--sagemath- test.netlify.app/html/en/reference/references/#hunk2 to check ### 📝 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: ... --> sagemath#38220 URL: sagemath#38274 Reported by: Kwankyu Lee Reviewer(s):
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> as sagemath#38220 allows us to implement the version selector to sage doc. Preview : https://doc-pr-53--sagemath- test.netlify.app/html/en/reference/ The script `sage-update-version`(used by the release manager) updates src/doc/website/versions.txt. The file will be accessible from https://doc-release--sagemath.netlify.app/html/en/versions.txt, after 10.4 release. The Preview is using https://doc-release--sagemath- test.netlify.app/html/en/versions.txt for test purpose. ### 📝 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: ... --> sagemath#38274 URL: sagemath#38285 Reported by: Kwankyu Lee Reviewer(s): Kwankyu Lee, Matthias Köppe
Fix a bug that deployed a PR doc preview to the production site https://sagemath.netlify.app, which is supposed to serve the doc preview for a release.
The reason of the behavior seems that if PR number is missing somehow, the doc is deployed to the production site, as seen here
It started so at least. Now this PR ended in fixing a few things in doc-publish and doc-build-pdf, and overhauling doc-publish logic.
Tests:
on pull request: https://github.com/kwankyu/sage/actions/runs/9635036620
deployed site: https://doc-pr-42--sagemath-test.netlify.app
on push branch develop: https://github.com/kwankyu/sage/actions/runs/9640827756
deployed site: https://doc-develop--sagemath-test.netlify.app
on push tag: https://github.com/kwankyu/sage/actions/runs/9641539263
deployed site: https://doc-10-4-beta29--sagemath-test.netlify.app
deployed site: https://doc-release--sagemath-test.netlify.app
on pull request, build-doc-pdf: https://github.com/kwankyu/sage/actions/runs/9634975196
📝 Checklist
⌛ Dependencies