Skip to content

Commit fe5fe9a

Browse files
authored
Deploy previews on RTD, main to GitHub Pages (#21)
* Deploy previews on RTD * add kernel * fix typo * add github pages build
1 parent a0b3e5d commit fe5fe9a

File tree

5 files changed

+94
-2
lines changed

5 files changed

+94
-2
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Build
22

33
on:
44
push:
5-
branches: main
5+
branches: [main]
66
pull_request:
7-
branches: '*'
7+
branches: ['*']
88

99
concurrency:
1010
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -54,6 +54,47 @@ jobs:
5454
path: dist/jupyterlab_hybrid_kernels*
5555
if-no-files-found: error
5656

57+
build_lite:
58+
runs-on: ubuntu-latest
59+
needs: build
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
- name: Setup Python
64+
uses: actions/setup-python@v5
65+
with:
66+
python-version: '3.11'
67+
- uses: actions/download-artifact@v4
68+
with:
69+
name: extension-artifacts
70+
- name: Install the dependencies
71+
run: |
72+
python -m pip install --pre jupyterlite-core jupyterlite-pyodide-kernel jupyterlab_hybrid_kernels*.whl
73+
- name: Build the JupyterLite site
74+
run: |
75+
jupyter lite build --output-dir dist
76+
- name: Upload artifact
77+
uses: actions/upload-pages-artifact@v3
78+
with:
79+
path: ./dist
80+
81+
deploy_lite:
82+
needs: build_lite
83+
if: github.ref == 'refs/heads/main'
84+
permissions:
85+
pages: write
86+
id-token: write
87+
88+
environment:
89+
name: github-pages
90+
url: ${{ steps.deployment.outputs.page_url }}
91+
92+
runs-on: ubuntu-latest
93+
steps:
94+
- name: Deploy to GitHub Pages
95+
id: deployment
96+
uses: actions/deploy-pages@v4
97+
5798
test_isolated:
5899
needs: build
59100
runs-on: ubuntu-latest

.github/workflows/rtd-preview.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: RTD Preview
2+
on:
3+
pull_request_target:
4+
types: [opened]
5+
6+
permissions:
7+
pull-requests: write
8+
9+
jobs:
10+
binder:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Comment on the PR with the RTD preview
14+
uses: actions/github-script@v6
15+
with:
16+
github-token: ${{secrets.GITHUB_TOKEN}}
17+
script: |
18+
var PR_NUMBER = context.issue.number
19+
github.rest.issues.createComment({
20+
issue_number: context.issue.number,
21+
owner: context.repo.owner,
22+
repo: context.repo.repo,
23+
body: `[![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://jupyterlab-hybrid-kernels--${PR_NUMBER}.org.readthedocs.build/en/${PR_NUMBER}) :point_left: Try it on ReadTheDocs`
24+
})

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,7 @@ dmypy.json
126126

127127
# Jupyter Notebooks
128128
[Uu]ntitled*
129+
130+
# JupyterLite
131+
.jupyterlite.doit.db
132+
_output/

.readthedocs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: mambaforge-latest
7+
commands:
8+
- mamba env update --name base --file docs/environment.yml
9+
- python -m pip install .
10+
- jupyter lite build --output-dir dist
11+
- mkdir -p $READTHEDOCS_OUTPUT/html
12+
- cp -r dist/* $READTHEDOCS_OUTPUT/html/

docs/environment.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: jupyterlab-hybrid-kernels
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- pip
6+
- python=3.11
7+
- ipywidgets>=8.1,<9
8+
- jupyterlab>=4.5.0,<5
9+
- nodejs=22
10+
- jupyterlite-core>=0.7.0,<0.8
11+
- jupyterlite-pyodide-kernel>=0.7.0,<0.8

0 commit comments

Comments
 (0)