Skip to content

Commit 192c047

Browse files
tonyfastrgommers
andauthored
add an action to deploy to github pages when pushed to master. (#81)
* add an action to deploy to github pages when pushed to master. * create a draft of the sphinx docs before deploying to master * build docs and deploy only on master * CI: use requirements.txt to install dependencies in GH Actions * Make sure to trigger on pull requests * Fix Sphinx build and upload * Fix the stage that only runs on PRs * Get rid of doctrees in deployed html docs Co-authored-by: Ralf Gommers <ralf.gommers@gmail.com>
1 parent e6fa8c4 commit 192c047

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/pages.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- "**"
8+
jobs:
9+
run:
10+
runs-on: ubuntu-18.04
11+
steps:
12+
# - uses: docker://pandoc/latex:2.9
13+
- uses: actions/checkout@master
14+
- uses: actions/setup-python@v2
15+
with:
16+
python-version: '3.8' # Version range or exact version of a Python version to use, using semvers version range syntax.
17+
architecture: 'x64' # (x64 or x86)
18+
- run: |
19+
# add dependencies based on the conf.py
20+
pip install -r requirements.txt
21+
- name: Build docs
22+
run: |
23+
# Turn warnings into errors; ensure .doctrees doesn't get deployed
24+
sphinx-build -b html -WT --keep-going spec build/latest -d doctrees
25+
touch build/.nojekyll
26+
- uses: actions/upload-artifact@v2
27+
if: ${{ github.event_name == 'pull_request'}}
28+
with:
29+
name: html
30+
path: build/
31+
if-no-files-found: error
32+
- name: Deploy
33+
if: ${{ github.ref == 'refs/heads/master'}}
34+
uses: JamesIves/github-pages-deploy-action@master
35+
env:
36+
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
BASE_BRANCH: master # The branch the action should deploy from.
38+
BRANCH: gh-pages # The branch the action should deploy to.
39+
FOLDER: build

0 commit comments

Comments
 (0)