Skip to content

Commit 2075ccb

Browse files
committed
Use Vercel action for continuous documentation
1 parent e057927 commit 2075ccb

File tree

3 files changed

+95
-14
lines changed

3 files changed

+95
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# This workflow deploys documentation to Vercel for previewing PRs
2+
3+
name: Continuous Documentation
4+
5+
on:
6+
pull_request:
7+
paths:
8+
- 'doc/**'
9+
- 'examples/**'
10+
- 'pygmt/**'
11+
- 'README.rst'
12+
- '.github/workflows/continuous-documentation.yml'
13+
pull_request_target:
14+
paths:
15+
- 'doc/**'
16+
- 'examples/**'
17+
- 'pygmt/**'
18+
- 'README.rst'
19+
- '.github/workflows/continuous-documentation.yml'
20+
21+
jobs:
22+
vercel:
23+
name: Deploy to Vercel
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Cancel Previous Runs
28+
uses: styfle/[email protected]
29+
with:
30+
access_token: ${{ github.token }}
31+
32+
- name: Checkout
33+
uses: actions/[email protected]
34+
with:
35+
# fecth all history so that setuptools-scm works
36+
fetch-depth: 0
37+
38+
# Setup Miniconda
39+
- name: Setup Miniconda
40+
uses: conda-incubator/[email protected]
41+
with:
42+
activate-environment: pygmt
43+
python-version: 3.9
44+
channels: conda-forge
45+
miniconda-version: "latest"
46+
47+
- name: Install dependencies
48+
shell: bash -l {0}
49+
run: |
50+
conda install gmt=6.1.1 numpy pandas xarray netcdf4 packaging \
51+
ipython myst-parser sphinx sphinx-copybutton \
52+
sphinx-gallery sphinx_rtd_theme=0.4.3
53+
54+
- name: List installed packages
55+
shell: bash -l {0}
56+
run: conda list
57+
58+
- name: Download remote data from GitHub
59+
uses: dawidd6/[email protected]
60+
with:
61+
workflow: cache_data.yaml
62+
workflow_conclusion: success
63+
name: gmt-cache
64+
path: .gmt
65+
66+
- name: Move and list downloaded remote files
67+
shell: bash -l {0}
68+
run: |
69+
mkdir -p ~/.gmt
70+
mv .gmt/* ~/.gmt
71+
# Change modification times of the two files, so GMT won't refresh it
72+
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt
73+
ls -lhR ~/.gmt
74+
75+
- name: Install the package
76+
shell: bash -l {0}
77+
run: |
78+
python setup.py sdist --formats=zip
79+
pip install dist/*
80+
81+
- name: Build the documentation
82+
shell: bash -l {0}
83+
run: make -C doc clean all
84+
85+
- name: Deploy documentation to Vercel
86+
uses: amondnet/[email protected]
87+
with:
88+
# https://vercel.com/account/tokens
89+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
90+
# vercel-org-id and vercel-project-id are generated using vercel CLI
91+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
92+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
93+
github-token: ${{ secrets.GITHUB_TOKEN }}
94+
github-comment: true
95+
working-directory: ./doc/_build/html

package.json

-8
This file was deleted.

vercel.json

-6
This file was deleted.

0 commit comments

Comments
 (0)