[pre-commit.ci] pre-commit autoupdate #207
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Preview | |
on: [pull_request] | |
permissions: | |
pull-requests: write # allow surge-preview to create/update PR comments | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
preview: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup JupyterBook Cache | |
uses: actions/cache@v3 | |
with: | |
path: _build | |
# NOTE: change key to "jupyterbook-DATE" to force rebuilding cache | |
key: jupyterbook-20230707 | |
- name: Install Conda environment with Micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: conda/conda-lock.yml | |
environment-name: xarray-tutorial | |
cache-environment: true | |
- name: Build JupyterBook | |
# NOTE: login shell activates conda environment | |
shell: bash -l {0} | |
run: | | |
jupyter-book build ./ --warningiserror --keep-going | |
- name: Dump Build Logs | |
if: always() | |
run: | | |
if (test -a _build/html/reports/*log); then cat _build/html/reports/*log ; fi | |
- name: Publish to Surge | |
id: preview_step | |
uses: afc163/surge-preview@v1 | |
with: | |
surge_token: ${{ secrets.SURGE_TOKEN }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
dist: _build/html | |
build: | | |
npm install surge | |
- name: Format preview url | |
id: format_url | |
run: | | |
echo "url_text=:rocket: Preview deployed at https://${{ steps.preview_step.outputs.preview_url }}" >> $GITHUB_OUTPUT | |
- name: Get the preview_url | |
run: echo "${{ steps.format_url.outputs.url_text }}" | |
- name: Generate summary | |
run: | | |
echo "#### ${{ steps.format_url.outputs.url_text }}" >> $GITHUB_STEP_SUMMARY |