|
| 1 | +# Copyright (c) Facebook, Inc. and its affiliates. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Update Documentation |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + paths: |
| 20 | + - "velox/docs/**" |
| 21 | + - ".github/workflows/docs.yml" |
| 22 | + |
| 23 | + pull_request: |
| 24 | + paths: |
| 25 | + - "velox/docs/**" |
| 26 | + - ".github/workflows/docs.yml" |
| 27 | + |
| 28 | +permissions: |
| 29 | + contents: write |
| 30 | + |
| 31 | +concurrency: |
| 32 | + group: ${{ github.workflow }}-${{ github.repository }}-${{ github.head_ref || github.sha }} |
| 33 | + cancel-in-progress: true |
| 34 | + |
| 35 | +jobs: |
| 36 | + build_docs: |
| 37 | + name: Build and Push |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 43 | + with: |
| 44 | + fetch-depth: 0 |
| 45 | + |
| 46 | + - name: Setup Git User |
| 47 | + run: | |
| 48 | + git config --global user.email "velox@users.noreply.github.com" |
| 49 | + git config --global user.name "velox" |
| 50 | +
|
| 51 | + - name: Install Dependencies |
| 52 | + run: | |
| 53 | + sudo apt update |
| 54 | + sudo apt install -y pandoc |
| 55 | + pip install sphinx sphinx-tabs breathe sphinx_rtd_theme chardet |
| 56 | +
|
| 57 | + - name: Build Documentation |
| 58 | + run: | |
| 59 | + cd velox/docs |
| 60 | + make clean |
| 61 | + # pyvelox |
| 62 | + mkdir -p bindings/python |
| 63 | + pandoc ../../pyvelox/README.md --from markdown --to rst -s -o bindings/python/README_generated_pyvelox.rst |
| 64 | + # velox |
| 65 | + make html |
| 66 | +
|
| 67 | + - name: Push Documentation |
| 68 | + if: ${{ github.event_name == 'push' && github.repository == 'facebookincubator/velox'}} |
| 69 | + run: | |
| 70 | + git checkout gh-pages |
| 71 | + cp -R velox/docs/_build/html/* docs |
| 72 | + git add docs |
| 73 | +
|
| 74 | + if [ -n "$(git status --porcelain --untracked-files=no)" ] |
| 75 | + then |
| 76 | + git commit -m "Update documentation" |
| 77 | + git push |
| 78 | + fi |
| 79 | +
|
| 80 | + - name: Upload Documentation |
| 81 | + if: github.event_name == 'pull_request' |
| 82 | + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 |
| 83 | + with: |
| 84 | + path: velox/docs/_build/html |
| 85 | + retention-days: 3 |
0 commit comments