|
| 1 | +name: Build Docs |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize] |
| 6 | +jobs: |
| 7 | + build-docs: |
| 8 | + runs-on: ubuntu-20.04 |
| 9 | + steps: |
| 10 | + - name: Dump GitHub context |
| 11 | + env: |
| 12 | + GITHUB_CONTEXT: ${{ toJson(github) }} |
| 13 | + run: echo "$GITHUB_CONTEXT" |
| 14 | + - uses: actions/checkout@v2 |
| 15 | + - name: Set up Python |
| 16 | + uses: actions/setup-python@v2 |
| 17 | + with: |
| 18 | + python-version: "3.7" |
| 19 | + - uses: actions/cache@v2 |
| 20 | + id: cache |
| 21 | + with: |
| 22 | + path: ${{ env.pythonLocation }} |
| 23 | + key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-docs |
| 24 | + - name: Install poetry |
| 25 | + if: steps.cache.outputs.cache-hit != 'true' |
| 26 | + run: | |
| 27 | + python -m pip install --upgrade pip |
| 28 | + python -m pip install "poetry>=1.2.0a1" |
| 29 | + python -m poetry plugin add poetry-version-plugin |
| 30 | + - name: Configure poetry |
| 31 | + run: python -m poetry config virtualenvs.in-project true |
| 32 | + - name: Ensure cache is healthy |
| 33 | + if: steps.cache.outputs.cache-hit == 'true' |
| 34 | + run: python -m poetry run pip --version >/dev/null 2>&1 || rm -rf .venv |
| 35 | + - name: Install Dependencies |
| 36 | + if: steps.cache.outputs.cache-hit != 'true' |
| 37 | + run: python -m poetry install |
| 38 | + - name: Install Material for MkDocs Insiders |
| 39 | + if: github.event.pull_request.head.repo.fork == false && steps.cache.outputs.cache-hit != 'true' |
| 40 | + run: pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git |
| 41 | + - name: Build Docs |
| 42 | + run: python3.7 -m mkdocs build |
| 43 | + - name: Zip docs |
| 44 | + run: bash ./scripts/zip-docs.sh |
| 45 | + - uses: actions/upload-artifact@v2 |
| 46 | + with: |
| 47 | + name: docs-zip |
| 48 | + path: ./docs.zip |
| 49 | + - name: Deploy to Netlify |
| 50 | + |
| 51 | + with: |
| 52 | + publish-dir: './site' |
| 53 | + production-branch: main |
| 54 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + enable-commit-comment: false |
| 56 | + env: |
| 57 | + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 58 | + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
0 commit comments