|
| 1 | +name: Build documentation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - dev |
| 7 | + - ghactions-docs |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-environment: |
| 11 | + runs-on: ubuntu-18.04 |
| 12 | + name: Build environment |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout repository |
| 16 | + uses: actions/checkout@v2 |
| 17 | + |
| 18 | + # See: https://github.com/marketplace/actions/setup-conda |
| 19 | + - name: Setup anaconda |
| 20 | + uses: s-weigand/setup-conda@v1 |
| 21 | + with: |
| 22 | + conda-channels: "conda-forge" |
| 23 | + |
| 24 | + - name: Cache conda environment |
| 25 | + id: cache-environment |
| 26 | + uses: actions/cache@v2 |
| 27 | + # Conda environment build step depends on two files, |
| 28 | + # so we ensure that the hash key contains both their hashes. |
| 29 | + with: |
| 30 | + path: | |
| 31 | + pyjanitor-dev.tar.gz |
| 32 | + key: ${{ runner.os }}-env.${{ hashFiles('environment-dev.yml') }} |
| 33 | + |
| 34 | + - name: Build environment |
| 35 | + if: steps.cache-environment.outputs.cache-hit != 'true' |
| 36 | + run: | |
| 37 | + conda env create -f environment-dev.yml |
| 38 | + python -m pip install . |
| 39 | +
|
| 40 | + - name: Install conda-pack |
| 41 | + if: steps.cache-environment.outputs.cache-hit != 'true' |
| 42 | + run: conda install -c conda-forge conda-pack |
| 43 | + |
| 44 | + - name: Run conda-pack |
| 45 | + if: steps.cache-environment.outputs.cache-hit != 'true' |
| 46 | + run: conda pack -n pyjanitor-dev -o pyjanitor-dev.tar.gz |
| 47 | + |
| 48 | + # See: https://github.com/actions/upload-artifact |
| 49 | + - name: Upload environment |
| 50 | + uses: actions/upload-artifact@v2 |
| 51 | + with: |
| 52 | + name: pyjanitor-dev-tarball |
| 53 | + path: pyjanitor-dev.tar.gz |
| 54 | + |
| 55 | + docs: |
| 56 | + name: Build static site docs |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: build-environment |
| 59 | + |
| 60 | + steps: |
| 61 | + - name: Checkout repository |
| 62 | + uses: actions/checkout@v2 |
| 63 | + |
| 64 | + # https://github.com/actions/download-artifact |
| 65 | + - name: Download environment tarball |
| 66 | + uses: actions/download-artifact@v2 |
| 67 | + with: |
| 68 | + name: pyjanitor-dev-tarball |
| 69 | + |
| 70 | + - name: Unpack environment and activate it |
| 71 | + run: | |
| 72 | + bash scripts/ci/unpack_environment.sh |
| 73 | +
|
| 74 | + - name: Build docs |
| 75 | + run: | |
| 76 | + source /tmp/pyjanitor-dev_env/bin/activate |
| 77 | + python -m ipykernel install --user --name pyjanitor-dev |
| 78 | + pip install -e . |
| 79 | + make docs |
| 80 | +
|
| 81 | + - name: Deploy website |
| 82 | + uses: peaceiris/actions-gh-pages@v3 |
| 83 | + with: |
| 84 | + # https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token |
| 85 | + personal_token: ${{ secrets.GHPAGES_TOKEN }} |
| 86 | + publish_dir: ./docs/_build/html |
| 87 | + publish_branch: gh-pages |
| 88 | + # destination_dir: manuscript |
| 89 | + allow_empty_commit: false |
| 90 | + keep_files: false |
| 91 | + force_orphan: true |
| 92 | + enable_jekyll: false |
| 93 | + disable_nojekyll: false |
0 commit comments