Skip to content

Commit 1a54d8c

Browse files
committed
Revert changes likely to incur merge conflict
1 parent 9dd8572 commit 1a54d8c

File tree

2 files changed

+39
-41
lines changed

2 files changed

+39
-41
lines changed

.github/workflows/doc-build.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
path: upstream
3939
name: upstream
4040

41-
build-doc:
41+
build-docs:
4242
runs-on: ubuntu-latest
4343
container: ghcr.io/sagemath/sage/sage-ubuntu-focal-standard-with-targets:dev
4444
needs: [get_ci_fixes]
@@ -108,7 +108,7 @@ jobs:
108108
MAKE: make -j2 --output-sync=recurse
109109
SAGE_NUM_THREADS: 2
110110

111-
- name: Build doc
111+
- name: Build docs
112112
id: docbuild
113113
if: always() && (steps.incremental.outcome == 'success' || steps.build.outcome == 'success')
114114
# Always non-incremental because of the concern that
@@ -125,23 +125,23 @@ jobs:
125125
MAKE: make -j2 --output-sync=recurse
126126
SAGE_NUM_THREADS: 2
127127

128-
- name: Copy doc
128+
- name: Copy docs
129129
id: copy
130130
if: always() && steps.docbuild.outcome == 'success'
131131
run: |
132132
set -ex
133-
mkdir -p ./doc
133+
mkdir -p ./docs
134134
(cd /sage/local/share/doc/sage/html && git commit -a -m 'new')
135135
# Wipe out chronic diffs between old doc and new doc
136136
(cd /sage/local/share/doc/sage/html && \
137137
find . -name "*.html" | xargs sed -i -e '\;<script type="application/vnd\.jupyter\.widget-state+json">;,\;</script>; d')
138138
# Create CHANGES.html
139-
echo '<html>' > ./doc/CHANGES.html
140-
echo '<head>' >> ./doc/CHANGES.html
141-
echo '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">' >> ./doc/CHANGES.html
142-
echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>' >> ./doc/CHANGES.html
143-
echo '<script>hljs.highlightAll();</script>' >> ./doc/CHANGES.html
144-
cat >> ./doc/CHANGES.html << EOF
139+
echo '<html>' > ./docs/CHANGES.html
140+
echo '<head>' >> ./docs/CHANGES.html
141+
echo '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">' >> ./docs/CHANGES.html
142+
echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>' >> ./docs/CHANGES.html
143+
echo '<script>hljs.highlightAll();</script>' >> ./docs/CHANGES.html
144+
cat >> ./docs/CHANGES.html << EOF
145145
<script>
146146
document.addEventListener('DOMContentLoaded', () => {
147147
const diffSite = 'https://pianomister.github.io/diffsite/'
@@ -160,12 +160,12 @@ jobs:
160160
});
161161
</script>
162162
EOF
163-
echo '</head>' >> ./doc/CHANGES.html
164-
echo '<body>' >> ./doc/CHANGES.html
165-
(cd /sage/local/share/doc/sage/html && git diff HEAD^ -- *.html; rm -rf .git) > ./doc/diff.txt
163+
echo '</head>' >> ./docs/CHANGES.html
164+
echo '<body>' >> ./docs/CHANGES.html
165+
(cd /sage/local/share/doc/sage/html && git diff HEAD^ -- *.html; rm -rf .git) > ./docs/diff.txt
166166
/sage/sage -python - << EOF
167167
import re, html
168-
with open('./doc/diff.txt', 'r') as f:
168+
with open('./docs/diff.txt', 'r') as f:
169169
diff_text = f.read()
170170
diff_blocks = re.split(r'^(?=diff --git)', diff_text, flags=re.MULTILINE)
171171
out_blocks = []
@@ -175,28 +175,28 @@ jobs:
175175
path = 'html/' + match.group(1)
176176
out_blocks.append(f'<p class="diff"><a href="{path}">{path}</a>&emsp;</p>\n<pre><code class="language-diff">' + html.escape(block).strip() + '</code></pre>')
177177
output_text = '\n'.join(out_blocks)
178-
with open('./doc/diff.html', 'w') as f:
178+
with open('./docs/diff.html', 'w') as f:
179179
f.write(output_text)
180180
EOF
181-
cat ./doc/diff.html >> ./doc/CHANGES.html
182-
echo '</body>' >> ./doc/CHANGES.html
183-
echo '</html>' >>./doc/CHANGES.html
184-
rm ./doc/diff.txt ./doc/diff.html
181+
cat ./docs/diff.html >> ./docs/CHANGES.html
182+
echo '</body>' >> ./docs/CHANGES.html
183+
echo '</html>' >>./docs/CHANGES.html
184+
rm ./docs/diff.txt ./docs/diff.html
185185
(cd /sage/local/share/doc/sage/html && git reset --hard HEAD)
186186
# For some reason the deploy step below cannot find /sage/...
187187
# So copy everything from there to local folder
188188
# We also need to replace the symlinks because netlify is not following them
189-
cp -r -L /sage/local/share/doc/sage/html ./doc
190-
cp /sage/local/share/doc/sage/index.html ./doc
189+
cp -r -L /sage/local/share/doc/sage/html ./docs
190+
cp /sage/local/share/doc/sage/index.html ./docs
191191
# Zip everything for increased performance
192-
zip -r doc.zip doc
192+
zip -r docs.zip docs
193193
194-
- name: Upload doc
194+
- name: Upload docs
195195
if: always() && steps.copy.outcome == 'success'
196196
uses: actions/upload-artifact@v3
197197
with:
198-
name: doc
199-
path: doc.zip
198+
name: docs
199+
path: docs.zip
200200

201201
- name: Build live doc
202202
id: buildlivedoc

.github/workflows/doc-publish.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Publish the built documentation by taking the artifact and uploading it to Netlify.
1+
# Triggers after the documentation build has finished,
2+
# taking the artifact and uploading it to netlify
23
name: Publish documentation
34

45
on:
@@ -13,7 +14,7 @@ permissions:
1314
pull-requests: write
1415

1516
jobs:
16-
publish-doc:
17+
upload-docs:
1718
runs-on: ubuntu-latest
1819
if: github.event.workflow_run.conclusion == 'success'
1920
steps:
@@ -24,11 +25,9 @@ jobs:
2425
token: ${{ secrets.GITHUB_TOKEN }}
2526
sourceRunId: ${{ github.event.workflow_run.id }}
2627

27-
# Once https://github.com/actions/download-artifact/issues/172 and/or
28-
# https://github.com/actions/download-artifact/issues/60 is implemented,
29-
# we can use the official download-artifact action. For now, we use the solution from
30-
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
31-
- name: Download doc
28+
# Once https://github.com/actions/download-artifact/issues/172 and/or https://github.com/actions/download-artifact/issues/60 is implemented, we can use the official download-artifact action
29+
# For now use the solution from https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
30+
- name: Download docs
3231
uses: actions/[email protected]
3332
with:
3433
script: |
@@ -38,7 +37,7 @@ jobs:
3837
run_id: ${{github.event.workflow_run.id }},
3938
});
4039
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
41-
return artifact.name == "doc"
40+
return artifact.name == "docs"
4241
})[0];
4342
var download = await github.rest.actions.downloadArtifact({
4443
owner: context.repo.owner,
@@ -47,34 +46,33 @@ jobs:
4746
archive_format: 'zip',
4847
});
4948
var fs = require('fs');
50-
fs.writeFileSync('${{github.workspace}}/doc.zip', Buffer.from(download.data));
49+
fs.writeFileSync('${{github.workspace}}/docs.zip', Buffer.from(download.data));
5150
52-
- name: Extract doc
53-
run: unzip doc.zip -d doc && unzip doc/doc.zip -d doc/doc
51+
- name: Extract docs
52+
run: unzip docs.zip -d docs && unzip docs/docs.zip -d docs/docs
5453

5554
- name: Deploy to Netlify
5655
id: deploy-netlify
5756
uses: netlify/actions/cli@master
5857
with:
59-
args: deploy --dir=doc/doc/doc ${NETLIFY_PRODUCTION:+"--prod"} --message ${NETLIFY_MESSAGE} --alias ${NETLIFY_ALIAS}
58+
args: deploy --dir=docs/docs/docs ${NETLIFY_PRODUCTION:+"--prod"} --message ${NETLIFY_MESSAGE} --alias ${NETLIFY_ALIAS}
6059
env:
6160
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
6261
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
6362
NETLIFY_PRODUCTION: ${{ github.ref == 'refs/heads/develop' }}
6463
NETLIFY_MESSAGE: ${{ steps.source-run-info.outputs.pullRequestNumber }}
6564
NETLIFY_ALIAS: deploy-preview-${{ steps.source-run-info.outputs.pullRequestNumber }}
6665

67-
# Add deployment as status check, PR comment and annotation we could use
68-
# the nwtgck/actions-netlify action for that, except for that it is not
69-
# (yet) working in workflow_run context: # https://github.com/nwtgck/actions-netlify/issues/545
66+
# Add deployment as status check, PR comment and annotation
67+
# 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
7068
- name: Add/Update deployment status PR comment
7169
uses: marocchino/sticky-pull-request-comment@v2
7270
with:
7371
number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
7472
header: preview-comment
7573
recreate: true
7674
message: |
77-
:tada: [Documentation preview for this PR](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/html/en) (built with commit ${{ steps.source-run-info.outputs.sourceHeadSha }}; [changes](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/CHANGES.html)) is ready!
75+
[Documentation preview for this PR](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/html/en) (built with commit ${{ steps.source-run-info.outputs.sourceHeadSha }}; [changes](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/CHANGES.html)) is ready! :tada:
7876
7977
- name: Update deployment status PR check
8078
uses: myrotvorets/[email protected]

0 commit comments

Comments
 (0)