Skip to content

Commit eb12158

Browse files
authored
Merge branch 'main' into apply-ufunc-reorg
2 parents de48b60 + b81bca6 commit eb12158

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1010
permissions:
11-
contents: read
11+
contents: write
1212
pages: write
1313
id-token: write
1414

.github/workflows/preview.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: PR Preview
2+
3+
on: [pull_request]
4+
5+
permissions:
6+
pull-requests: write # allow surge-preview to create/update PR comments
7+
8+
jobs:
9+
preview:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v3
14+
15+
- name: Setup JupyterBook Cache
16+
uses: actions/cache@v3
17+
with:
18+
path: _build
19+
# NOTE: change key to "jupyterbook-DATE" to force rebuilding cache
20+
key: jupyterbook-20230613
21+
22+
- name: Install Conda environment with Micromamba
23+
uses: mamba-org/setup-micromamba@v1
24+
with:
25+
environment-file: conda/conda-lock.yml
26+
environment-name: xarray-tutorial
27+
cache-environment: true
28+
29+
- name: Build JupyterBook
30+
# NOTE: login shell activates conda environment
31+
shell: bash -l {0}
32+
run: |
33+
jupyter-book build ./ --warningiserror --keep-going
34+
35+
- name: Dump Build Logs
36+
if: always()
37+
run: |
38+
if (test -a _build/html/reports/*log); then cat _build/html/reports/*log ; fi
39+
40+
- name: Publish to Surge
41+
id: preview_step
42+
uses: afc163/surge-preview@v1
43+
with:
44+
surge_token: ${{ secrets.SURGE_TOKEN }}
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
dist: _build/html
47+
build: |
48+
npm install surge
49+
50+
- name: Format preview url
51+
id: format_url
52+
run: |
53+
echo "url_text=:rocket: Preview deployed at https://${{ steps.preview_step.outputs.preview_url }}" >> $GITHUB_OUTPUT
54+
55+
- name: Get the preview_url
56+
run: echo "${{ steps.format_url.outputs.url_text }}"
57+
58+
- name: Generate summary
59+
run: |
60+
echo "#### ${{ steps.format_url.outputs.url_text }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)