| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you 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 docs |
| |
| on: |
| push: |
| branches: ['master'] |
| pull_request: |
| |
| jobs: |
| build: |
| runs-on: ubuntu-latest |
| |
| steps: |
| - name: π Checkout |
| uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 |
| with: |
| submodules: recursive |
| lfs: true |
| - name: π Setup Python |
| uses: actions/setup-python@41b7212b1668f5de9d65e9c82aa777e6bbedb3a8 # v2.1.4 |
| with: |
| python-version: '3.6' |
| - name: π³ Build Docker image |
| run: ./site.sh build-image |
| - name: π’ Install node depedencies |
| run: ./site.sh install-node-deps |
| - name: π Install Python depedencies |
| run: pip install -r requirements.txt |
| - name: π Lint |
| uses: apache/airflow-pre-commit-action@0764670bf370aab253130d534e1eda7ff497dc60 # v2.0.0 |
| - name: π§ Build site |
| run: ./site.sh build-site |
| - name: π
Optimize artifacts |
| if: ${{ github.event_name == 'pull_request' }} |
| run: | |
| rm -rf ./dist/docs/* |
| echo "These files have been deleted to optimize the size of the artifacts." > ./dist/docs/index.html |
| echo "Here was the contents of the ./docs-archive directory" >> ./dist/docs/index.html |
| find ./dist/ |
| - uses: actions/upload-artifact@726a6dcd0199f578459862705eed35cda05af50b # v2.2.1 |
| name: π Upload website as artifact |
| if: ${{ github.event_name == 'pull_request' }} |
| with: |
| name: airflow-website |
| path: './dist' |
| if-no-files-found: error |
| retention-days: 14 |
| - name: π Deploy website on asf-site branch |
| uses: apache/airflow-JamesIves-github-pages-deploy-action@132898c54c57c7cc6b80eb3a89968de8fc283505 # v3.7.1 |
| if: ${{ github.event_name == 'push' }} |
| with: |
| BRANCH: asf-site # The branch the action should deploy to. |
| FOLDER: dist # The folder the action should deploy. |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| CLEAN: true # Automatically remove deleted files from the deploy branch |
| - name: π§ Copy files from site to themeοΈ |
| run: ./site.sh prepare-theme |
| - name: π§ Prepare sphinx_airflow_theme package οΈ |
| working-directory: sphinx_airflow_theme |
| run: | |
| python3 -m pip install --user --upgrade setuptools wheel |
| python3 setup.py sdist bdist_wheel |
| - name: π Upload sphinx_airflow_theme package as artifact |
| uses: actions/upload-artifact@726a6dcd0199f578459862705eed35cda05af50b # v2.2.1 |
| with: |
| name: airflow-sphinx-theme |
| path: './sphinx_airflow_theme/dist' |
| if-no-files-found: error |
| retention-days: 14 |
| - name: π§ Build theme demo |
| working-directory: sphinx_airflow_theme |
| run: | |
| pip install ./dist/sphinx_airflow_theme-*.whl |
| cd demo |
| ./docs.sh build |
| - name: π Upload sphinx_airflow_theme demo as artifact |
| uses: actions/upload-artifact@726a6dcd0199f578459862705eed35cda05af50b # v2.2.1 |
| with: |
| name: airflow-sphinx-theme-demo |
| path: './sphinx_airflow_theme/demo/_build' |
| if-no-files-found: error |
| retention-days: 14 |
| - name: π Create releases on GitHub |
| working-directory: sphinx_airflow_theme |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| GITHUB_COMMIT: ${{ github.sha }} |
| GITHUB_REF: ${{ github.ref }} |
| if: > |
| github.ref == 'refs/heads/master' && github.repository == 'apache/airflow-site' && |
| github.event_name == 'push' |
| run: | |
| gh auth status |
| VERSION="$(python setup.py --version)" |
| TITLE=$(date "+%Y-%m-%d %H:%M:%S") |
| NOTES="Commit: ${GITHUB_COMMIT} |
| Source: ${GITHUB_REF}" |
| |
| gh release delete "${VERSION}" -y || true |
| gh release create "${VERSION}" \ |
| --title "${TITLE}" \ |
| --notes "${NOTES}" \ |
| ./dist/* |