Edit and Update: Enhancements to Cal-ITP Data Services Documentation #2557
Workflow file for this run
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: 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@v2 | |
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 |