|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +name: Deploy DataFusion Java site |
| 19 | + |
| 20 | +on: |
| 21 | + push: |
| 22 | + branches: |
| 23 | + - main |
| 24 | + paths: |
| 25 | + - .asf.yaml |
| 26 | + - .github/workflows/docs.yaml |
| 27 | + - docs/** |
| 28 | + pull_request: |
| 29 | + branches: |
| 30 | + - main |
| 31 | + paths: |
| 32 | + - .asf.yaml |
| 33 | + - .github/workflows/docs.yaml |
| 34 | + - docs/** |
| 35 | + |
| 36 | +permissions: |
| 37 | + contents: write |
| 38 | + |
| 39 | +jobs: |
| 40 | + build-docs: |
| 41 | + name: Build docs |
| 42 | + if: ${{ startsWith(github.repository, 'apache/') }} |
| 43 | + runs-on: ubuntu-latest |
| 44 | + steps: |
| 45 | + - name: Checkout docs sources |
| 46 | + uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - name: Checkout asf-site branch |
| 49 | + if: github.event_name == 'push' |
| 50 | + uses: actions/checkout@v4 |
| 51 | + with: |
| 52 | + ref: asf-site |
| 53 | + path: asf-site |
| 54 | + |
| 55 | + - name: Setup Python |
| 56 | + uses: actions/setup-python@v5 |
| 57 | + with: |
| 58 | + python-version: "3.10" |
| 59 | + |
| 60 | + - name: Install dependencies |
| 61 | + run: | |
| 62 | + set -x |
| 63 | + python3 -m venv venv |
| 64 | + source venv/bin/activate |
| 65 | + pip install --upgrade pip |
| 66 | + pip install -r docs/requirements.txt |
| 67 | +
|
| 68 | + - name: Build docs |
| 69 | + run: | |
| 70 | + set -x |
| 71 | + source venv/bin/activate |
| 72 | + cd docs |
| 73 | + ./build.sh |
| 74 | +
|
| 75 | + - name: Copy & push the generated HTML |
| 76 | + if: github.event_name == 'push' |
| 77 | + run: | |
| 78 | + set -x |
| 79 | + cd asf-site |
| 80 | + rsync \ |
| 81 | + -a \ |
| 82 | + --delete \ |
| 83 | + --exclude '/.git/' \ |
| 84 | + ../docs/build/html/ \ |
| 85 | + ./ |
| 86 | + cp ../.asf.yaml . |
| 87 | + touch .nojekyll |
| 88 | + git status --porcelain |
| 89 | + if [ -n "$(git status --porcelain)" ]; then |
| 90 | + git config user.name "github-actions[bot]" |
| 91 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 92 | + git add --all |
| 93 | + git commit -m "Publish built docs triggered by ${{ github.sha }}" |
| 94 | + git push || git push --force |
| 95 | + fi |
0 commit comments