Skip to content

Test commit

Test commit #2562

Workflow file for this run

name: Build and publish docs
on:
push:
branches:
- main
paths:
- 'docs/**'
pull_request:
paths:
- 'docs/**'
workflow_dispatch:
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v1
with:
python-version: 3.9
- run: pip install -r docs/requirements.txt
- uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- uses: google-github-actions/setup-gcloud@v2
- name: Build jupyter book
run: jb build docs --warningiserror --keep-going # set doc to fail on any sphinx warning
- uses: actions/upload-artifact@v3
if: always()
with:
name: docs-build
path: docs/_build/html
# Production
- name: Deploy docs to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
publish_branch: gh-pages
- name: Deploy docs preview to Netlify
if: ${{ github.ref != 'refs/heads/main' }}
run: |
npm install -g netlify-cli
netlify deploy --dir=docs/_build/html --alias=docs-${GITHUB_REPOSITORY#*/}-${PR_NUMBER}
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
- uses: peter-evans/find-comment@v2
if: ${{ github.event_name == 'pull_request' }}
id: fc
with:
issue-number: ${{ github.event.number }}
comment-author: 'github-actions[bot]'
body-includes: --cal-itp-previews.netlify.app
- uses: peter-evans/create-or-update-comment@v2
if: ${{ github.event_name == 'pull_request' }}
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body: "Preview url: https://docs-${{github.event.repository.name}}-${{ github.event.number }}--cal-itp-previews.netlify.app"
edit-mode: replace