Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/continuous-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# This workflow deploys documentation to Vercel for previewing PRs

name: Continuous Documentation

on:
pull_request:
paths:
- 'doc/**'
- 'examples/**'
- 'pygmt/**'
- 'README.rst'
- '.github/workflows/continuous-documentation.yml'
pull_request_target:
paths:
- 'doc/**'
- 'examples/**'
- 'pygmt/**'
- 'README.rst'
- '.github/workflows/continuous-documentation.yml'

jobs:
vercel:
name: Deploy to Vercel
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/[email protected]
with:
# fecth all history so that setuptools-scm works
fetch-depth: 0

# Setup Miniconda
- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
activate-environment: pygmt
python-version: 3.9
channels: conda-forge
miniconda-version: "latest"

- name: Install dependencies
shell: bash -l {0}
run: |
conda install gmt=6.1.1 numpy pandas xarray netcdf4 packaging \
ipython myst-parser sphinx sphinx-copybutton \
sphinx-gallery sphinx_rtd_theme=0.4.3
Comment on lines +52 to +54
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I only install the packages required for documentation, to save the building time.


- name: List installed packages
shell: bash -l {0}
run: conda list

- name: Download remote data from GitHub
uses: dawidd6/[email protected]
with:
workflow: cache_data.yaml
workflow_conclusion: success
name: gmt-cache
path: .gmt

- name: Move and list downloaded remote files
shell: bash -l {0}
run: |
mkdir -p ~/.gmt
mv .gmt/* ~/.gmt
# Change modification times of the two files, so GMT won't refresh it
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt
ls -lhR ~/.gmt

- name: Install the package
shell: bash -l {0}
run: |
python setup.py sdist --formats=zip
pip install dist/*

- name: Build the documentation
shell: bash -l {0}
run: make -C doc clean all

- name: Deploy documentation to Vercel
uses: amondnet/[email protected]
with:
# https://vercel.com/account/tokens
vercel-token: ${{ secrets.VERCEL_TOKEN }}
# vercel-org-id and vercel-project-id are generated using vercel CLI
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
github-token: ${{ secrets.GITHUB_TOKEN }}
github-comment: true
working-directory: ./doc/_build/html
8 changes: 0 additions & 8 deletions package.json

This file was deleted.

6 changes: 0 additions & 6 deletions vercel.json

This file was deleted.