Skip to content

Commit 26a25cf

Browse files
committed
feat: only publish examples on colab, use action to directly deploy docs
This greatly reduces the size of the repository, as we don't have to store 100MBs of images on an orphaned branch anymore.
1 parent 90cb9d1 commit 26a25cf

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

.github/workflows/docs.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ jobs:
7474
export MRINUFFT_BACKEND=cufinufft
7575
python -m sphinx docs docs_build ${{ contains(github.event.comment.body, 'fast') && '-D plot_gallery=0' || '' }} -j 5
7676
77+
78+
- name: Upload artifact for pages
79+
if: ${{ github.event_name == 'workflow_run' }}
80+
uses: actions/upload-pages-artifact@v4
81+
with:
82+
path: docs_build
83+
84+
7785
- name: Upload artifact
7886
id: artifact-upload-step
7987
uses: actions/upload-artifact@v4
@@ -84,6 +92,7 @@ jobs:
8492
retention-days: 5
8593

8694
- name: Get artifact ID
95+
if: contains(github.event.comment.body, '/build-docs') && github.event.issue.pull_request && success()
8796
id: get-artifact-id
8897
env:
8998
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -120,7 +129,10 @@ jobs:
120129
runs-on: ubuntu-latest
121130
needs: build-docs
122131
if: ${{ github.event_name == 'workflow_run' }}
123-
132+
permissions:
133+
pages: write
134+
id-token: write
135+
124136
steps:
125137
- name: Get the docs_build artifact
126138
uses: actions/download-artifact@v4
@@ -133,19 +145,19 @@ jobs:
133145
uses: actions/download-artifact@v4
134146
with:
135147
name: coverage_badge
136-
path: docs_build/_static
148+
path: docs_build/examples/_static
137149
run-id: ${{ github.event.workflow_run.id}}
138150
github-token: ${{ secrets.GITHUB_TOKEN }}
139151

140-
- name: Display structure of docs
141-
run: ls -R docs_build/
142-
143-
- name: Deploy to GitHub Pages
152+
- name: Deploy Examples for Colab import
144153
uses: peaceiris/actions-gh-pages@v4
145154
with:
146155
github_token: ${{ secrets.GITHUB_TOKEN }}
147-
publish_dir: ./docs_build
148-
destination_dir: . # Ensure you deploy to the root of the gh-pages branch
149-
publish_branch: gh-pages
156+
publish_dir: ./docs_build/examples
157+
destination_dir: examples
158+
publish_branch: colab-examples
150159
keep_files: false
151160
force_orphan: true
161+
162+
- name: Deploy to GitHub Pages
163+
uses: actions/deploy-pages@v4

docs/sphinx_add_colab_link.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def run(self):
4545
)
4646

4747
# Generate the Colab URL based on GitHub repo information
48-
self.colab_url = f"https://colab.research.google.com/github/mind-inria/mri-nufft/blob/gh-pages/examples/{notebook_repo_relative_path}"
48+
self.colab_url = f"https://colab.research.google.com/github/mind-inria/mri-nufft/blob/colab-examples/examples/{notebook_repo_relative_path}"
4949

5050
# Create the HTML button or link
5151
self.html = f"""<div class="colab-button">

0 commit comments

Comments
 (0)