|
| 1 | +# Copyright 2025-present Alibaba Inc. |
| 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: "Publish Docs" |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + branches: |
| 20 | + - main |
| 21 | + paths: |
| 22 | + - 'apidoc/**' |
| 23 | + - 'docs/**' |
| 24 | + - 'src/**' |
| 25 | + - 'include/**' |
| 26 | + |
| 27 | +concurrency: |
| 28 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 29 | + cancel-in-progress: false |
| 30 | + |
| 31 | +permissions: |
| 32 | + contents: write |
| 33 | + |
| 34 | +jobs: |
| 35 | + docs: |
| 36 | + runs-on: ubuntu-24.04 |
| 37 | + |
| 38 | + steps: |
| 39 | + |
| 40 | + with: |
| 41 | + fetch-depth: 1 |
| 42 | + |
| 43 | + - uses: actions/setup-python@v6 |
| 44 | + with: |
| 45 | + python-version: '3.x' |
| 46 | + |
| 47 | + - name: Install dependencies |
| 48 | + run: | |
| 49 | + sudo apt-get update |
| 50 | + sudo apt-get install -y doxygen |
| 51 | + make install-deps |
| 52 | +
|
| 53 | + - name: Build API |
| 54 | + run: | |
| 55 | + cd ./apidoc |
| 56 | + doxygen |
| 57 | + cd - |
| 58 | +
|
| 59 | + - name: Build Docs |
| 60 | + run: | |
| 61 | + cd docs |
| 62 | + make html |
| 63 | + mkdir -p /tmp/site |
| 64 | + cp -r ./_build/html/* /tmp/site/ |
| 65 | + cd - |
| 66 | +
|
| 67 | + - name: Deploy to gh-pages |
| 68 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 69 | + run: | |
| 70 | + git config --global user.name 'GitHub Actions' |
| 71 | + git config --global user.email '[email protected]' |
| 72 | +
|
| 73 | + git checkout --orphan gh-pages-tmp |
| 74 | + git rm --quiet -rf . |
| 75 | + cp -r /tmp/site/* . |
| 76 | + git add --all |
| 77 | + git commit -m "Publish docs from commit ${{ github.sha }}" |
| 78 | + git push -f origin gh-pages-tmp:gh-pages |
0 commit comments