-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (62 loc) · 2 KB
/
Copy pathgh-pages.yml
File metadata and controls
71 lines (62 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Build Pages
on:
push:
branches:
- master
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install Poetry
run: |
sudo apt install pandoc
pip install setuptools
pip install poetry
shell: bash
- name: Cache Poetry virtualenv
uses: actions/cache@v2
id: cache
with:
path: ~/.poetry/venv
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Configure poetry
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project false
poetry config cache-dir ~/.poetry
poetry config virtualenvs.path ~/.poetry/venv
pip3 install setuptools
- name: Install dependencies
run: |
export SETUPTOOLS_USE_DISTUTILS=stdlib
poetry install
if: steps.cache.outputs.cache-hit != 'true'
- name: Build documentation
run: |
poetry run sphinx-build -M html source build
- name: Commit documentation changes
run: |
git clone https://github.com/DataONEorg/api-documentation.git --branch gh-pages --single-branch gh-pages
cd gh-pages
find . -not -path '*/\.*' -delete
cp -r ../build/html/* .
touch .nojekyll
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present, so we ignore
# the return code.
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}