-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
757 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
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/* . | ||
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 }} |
Oops, something went wrong.