|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches: |
| 4 | + - master |
| 5 | + tags-ignore: |
| 6 | + - "**-rc**" |
| 7 | + |
| 8 | +name: Deploy DataFusion Python site |
| 9 | + |
| 10 | +jobs: |
| 11 | + build-docs: |
| 12 | + name: Build docs |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Set target branch |
| 16 | + id: target-branch |
| 17 | + run: | |
| 18 | + set -x |
| 19 | + if test '${{ github.ref }}' = 'refs/heads/master'; then |
| 20 | + echo "value=asf-staging" >> $GITHUB_OUTPUT |
| 21 | + elif test '${{ github.ref_type }}' = 'tag'; then |
| 22 | + echo "value=asf-site" >> $GITHUB_OUTPUT |
| 23 | + else |
| 24 | + echo "Unsupported input: ${{ github.ref }} / ${{ github.ref_type }}" |
| 25 | + exit 1 |
| 26 | + fi |
| 27 | + - name: Checkout docs sources |
| 28 | + uses: actions/checkout@v3 |
| 29 | + - name: Checkout docs target branch |
| 30 | + uses: actions/checkout@v3 |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + ref: ${{ steps.target-branch.outputs.value }} |
| 34 | + path: docs-target |
| 35 | + - name: Setup Python |
| 36 | + uses: actions/setup-python@v4 |
| 37 | + with: |
| 38 | + python-version: "3.10" |
| 39 | + |
| 40 | + - name: Install dependencies |
| 41 | + run: | |
| 42 | + set -x |
| 43 | + python3 -m venv venv |
| 44 | + source venv/bin/activate |
| 45 | + pip install -r requirements-310.txt |
| 46 | + pip install -r docs/requirements.txt |
| 47 | + - name: Build Datafusion |
| 48 | + run: | |
| 49 | + set -x |
| 50 | + source venv/bin/activate |
| 51 | + maturin develop |
| 52 | +
|
| 53 | + - name: Build docs |
| 54 | + run: | |
| 55 | + set -x |
| 56 | + source venv/bin/activate |
| 57 | + cd docs |
| 58 | + make html |
| 59 | +
|
| 60 | + - name: Copy & push the generated HTML |
| 61 | + run: | |
| 62 | + set -x |
| 63 | + cd docs-target |
| 64 | + # delete anything but: 1) '.'; 2) '..'; 3) .git/ |
| 65 | + find ./ | grep -vE "^./$|^../$|^./.git" | xargs rm -rf |
| 66 | + cp ../.asf.yaml . |
| 67 | + cp -r ../docs/build/html/* . |
| 68 | + git status --porcelain |
| 69 | + if [ "$(git status --porcelain)" != "" ]; then |
| 70 | + git config user.name "github-actions[bot]" |
| 71 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 72 | + git add --all |
| 73 | + git commit -m 'Publish built docs triggered by ${{ github.sha }}' |
| 74 | + git push || git push --force |
| 75 | + fi |
0 commit comments