Skip to content

Commit

Permalink
Reviewer request
Browse files Browse the repository at this point in the history
  • Loading branch information
kwankyu committed Jun 21, 2024
1 parent 56715da commit 5f98c36
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .ci/create-changes-html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ echo '<script>hljs.highlightAll();</script>' >> CHANGES.html
cat >> CHANGES.html << EOF
<script>
document.addEventListener('DOMContentLoaded', () => {
const baseDocURL = 'https://preview-release--sagemath.netlify.app'
const baseDocURL = 'https://doc-develop--sagemath.netlify.app'
const diffSite = 'https://pianomister.github.io/diffsite'
const diffParagraphs = document.querySelectorAll('p.diff');
diffParagraphs.forEach(paragraph => {
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/doc-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_MESSAGE: preview-${{ github.ref == 'refs/heads/develop' && 'release' || steps.source-run-info.outputs.pullRequestNumber }}
NETLIFY_ALIAS: preview-${{ github.ref == 'refs/heads/develop' && 'release' || steps.source-run-info.outputs.pullRequestNumber }}
NETLIFY_MESSAGE: doc-${{ github.ref == 'refs/heads/develop' && 'develop' || format('pr-{0}', steps.source-run-info.outputs.pullRequestNumber) }}
NETLIFY_ALIAS: doc-${{ github.ref == 'refs/heads/develop' && 'develop' || format('pr-{0}', steps.source-run-info.outputs.pullRequestNumber) }}

# Add deployment as status check, PR comment and annotation
# we could use the nwtgck/actions-netlify action for that, except for that it is not (yet) working in workflow_run context: https://github.com/nwtgck/actions-netlify/issues/545
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
publish-live-doc:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' && github.repository == 'sagemath/sage' && github.event.workflow_run.head_branch == 'develop'
if: github.event.workflow_run.conclusion == 'success' && github.repository == 'sagemath/sage' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Download live doc
uses: actions/[email protected]
Expand All @@ -120,6 +120,10 @@ jobs:
- name: Extract live doc
run: unzip livedoc.zip -d doc && unzip doc/livedoc.zip -d doc/doc

- name: Get REF_NAME
run: |
echo "REF_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Deploy to Netlify
id: deploy-netlify
uses: netlify/actions/cli@master
Expand All @@ -128,8 +132,8 @@ jobs:
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_MESSAGE: livedoc
NETLIFY_ALIAS: livedoc
NETLIFY_MESSAGE: doc-${{ env.REF_NAME }}
NETLIFY_ALIAS: doc-${{ env.REF_NAME }}

- name: Report deployment url
run: |
Expand Down
2 changes: 1 addition & 1 deletion src/sage_docbuild/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def linkcode_resolve(domain, info):
if not version.split('.')[-1].isnumeric(): # develop version
# This URL is hardcoded in the file .github/workflows/doc-publish.yml.
# See NETLIFY_ALIAS of the "Deploy to Netlify" step.
ver = f'<a href="https://preview-release--sagemath.netlify.app/html/en/index.html">{version}</a>'
ver = f'<a href="https://doc-develop--sagemath.netlify.app/html/en/index.html">{version}</a>'
github_ref = os.environ.get('GITHUB_REF', '')
if github_ref:
match = re.search(r'refs/pull/(\d+)/merge', github_ref)
Expand Down

0 comments on commit 5f98c36

Please sign in to comment.