nuttx/.github/workflows/sphinx-docs.yml
2020-08-24 10:29:55 -07:00

57 lines
1.8 KiB
YAML

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: "Build Sphinx Docs"
on:
pull_request:
push:
branches:
- master
- docs
- 'releases/*'
tags:
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: ammaraskar/sphinx-action@master
with:
docs-folder: "doc/"
- uses: actions/upload-artifact@v2
with:
name: sphinx-docs
path: doc/_build/html/
- name: Commit documentation changes
if: github.event_name != 'pull_request'
run: |
git clone https://github.com/v01d/incubator-nuttx.git --branch gh-pages --single-branch gh-pages
cd gh-pages
rm -rf ${GITHUB_REF##*/}
mkdir -p ${GITHUB_REF##*/}
cd ${GITHUB_REF##*/}
cp -r ../../doc/_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
if: github.event_name != 'pull_request'
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}