| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 02bd7eb commit a21d5c8
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,14 +7,34 @@ on: | |||
| 7 | 7 | types: | |
| 8 | 8 | - opened | |
| 9 | 9 | - synchronize | |
| 10 | - workflow_dispatch: | ||
| 11 | - inputs: | ||
| 12 | - debug_enabled: | ||
| 13 | - description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | ||
| 14 | - required: false | ||
| 15 | - default: false | ||
| 16 | 10 | jobs: | |
| 11 | + changes: | ||
| 12 | + runs-on: ubuntu-latest | ||
| 13 | + # Required permissions | ||
| 14 | + permissions: | ||
| 15 | + pull-requests: read | ||
| 16 | + # Set job outputs to values from filter step | ||
| 17 | + outputs: | ||
| 18 | + docs: ${{ steps.filter.outputs.docs }} | ||
| 19 | + steps: | ||
| 20 | + - uses: actions/checkout@v3 | ||
| 21 | + # For pull requests it's not necessary to checkout the code but for the main branch it is | ||
| 22 | + - uses: dorny/paths-filter@v2 | ||
| 23 | + id: filter | ||
| 24 | + with: | ||
| 25 | + filters: | | ||
| 26 | + docs: | ||
| 27 | + - README.md | ||
| 28 | + - docs/** | ||
| 29 | + - docs_src/** | ||
| 30 | + - pyproject.toml | ||
| 31 | + - mkdocs.yml | ||
| 32 | + - mkdocs.insiders.yml | ||
| 33 | + | ||
| 17 | 34 | build-docs: | |
| 35 | + needs: | ||
| 36 | + - changes | ||
| 37 | + if: ${{ needs.changes.outputs.docs == 'true' }} | ||
| 18 | 38 | runs-on: ubuntu-latest | |
| 19 | 39 | steps: | |
| 20 | 40 | - name: Dump GitHub context | |
@@ -26,18 +46,12 @@ jobs: | |||
| 26 | 46 | uses: actions/setup-python@v4 | |
| 27 | 47 | with: | |
| 28 | 48 | python-version: "3.11" | |
| 29 | - # Allow debugging with tmate | ||
| 30 | - - name: Setup tmate session | ||
| 31 | - uses: mxschmitt/action-tmate@v3 | ||
| 32 | - if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }} | ||
| 33 | - with: | ||
| 34 | - limit-access-to-actor: true | ||
| 35 | 49 | - uses: actions/cache@v3 | |
| 36 | 50 | id: cache | |
| 37 | 51 | with: | |
| 38 | 52 | path: ${{ env.pythonLocation }} | |
| 39 | - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-docs-v2 | ||
| 40 | - - name: Install poetry | ||
| 53 | + key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v01 | ||
| 54 | + - name: Install Poetry | ||
| 41 | 55 | if: steps.cache.outputs.cache-hit != 'true' | |
| 42 | 56 | run: | | |
| 43 | 57 | python -m pip install --upgrade pip | |
@@ -61,19 +75,20 @@ jobs: | |||
| 61 | 75 | - name: Build Docs with Insiders | |
| 62 | 76 | if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false | |
| 63 | 77 | run: python -m poetry run mkdocs build --config-file mkdocs.insiders.yml | |
| 64 | - - name: Zip docs | ||
| 65 | - run: python -m poetry run bash ./scripts/zip-docs.sh | ||
| 66 | 78 | - uses: actions/upload-artifact@v3 | |
| 67 | 79 | with: | |
| 68 | - name: docs-zip | ||
| 69 | - path: ./site/docs.zip | ||
| 70 | - - name: Deploy to Netlify | ||
| 71 | - uses: nwtgck/actions-netlify@v2.0.0 | ||
| 80 | + name: docs-site | ||
| 81 | + path: ./site/** | ||
| 82 | + | ||
| 83 | + # https://github.com/marketplace/actions/alls-green#why | ||
| 84 | + docs-all-green: # This job does nothing and is only used for the branch protection | ||
| 85 | + if: always() | ||
| 86 | + needs: | ||
| 87 | + - build-docs | ||
| 88 | + runs-on: ubuntu-latest | ||
| 89 | + steps: | ||
| 90 | + - name: Decide whether the needed jobs succeeded or failed | ||
| 91 | + uses: re-actors/alls-green@release/v1 | ||
| 72 | 92 | with: | |
| 73 | - publish-dir: './site' | ||
| 74 | - production-branch: main | ||
| 75 | - github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| 76 | - enable-commit-comment: false | ||
| 77 | - env: | ||
| 78 | - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
| 79 | - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
| 93 | + jobs: ${{ toJSON(needs) }} | ||
| 94 | + allowed-skips: build-docs | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,45 +1,48 @@ | |||
| 1 | - name: Preview Docs | ||
| 1 | + name: Deploy Docs | ||
| 2 | 2 | on: | |
| 3 | 3 | workflow_run: | |
| 4 | 4 | workflows: | |
| 5 | 5 | - Build Docs | |
| 6 | - types: | ||
| 6 | + types: | ||
| 7 | 7 | - completed | |
| 8 | 8 | ||
| 9 | 9 | jobs: | |
| 10 | - preview-docs: | ||
| 11 | - runs-on: ubuntu-20.04 | ||
| 10 | + deploy-docs: | ||
| 11 | + runs-on: ubuntu-latest | ||
| 12 | 12 | steps: | |
| 13 | - - uses: actions/checkout@v3.1.0 | ||
| 13 | + - name: Dump GitHub context | ||
| 14 | + env: | ||
| 15 | + GITHUB_CONTEXT: ${{ toJson(github) }} | ||
| 16 | + run: echo "$GITHUB_CONTEXT" | ||
| 17 | + - uses: actions/checkout@v3 | ||
| 14 | 18 | - name: Clean site | |
| 15 | 19 | run: | | |
| 16 | 20 | rm -rf ./site | |
| 17 | 21 | mkdir ./site | |
| 18 | 22 | - name: Download Artifact Docs | |
| 19 | - uses: dawidd6/action-download-artifact@v2.24.2 | ||
| 23 | + id: download | ||
| 24 | + uses: dawidd6/action-download-artifact@v2.27.0 | ||
| 20 | 25 | with: | |
| 26 | + if_no_artifact_found: ignore | ||
| 21 | 27 | github_token: ${{ secrets.GITHUB_TOKEN }} | |
| 22 | 28 | workflow: build-docs.yml | |
| 23 | 29 | run_id: ${{ github.event.workflow_run.id }} | |
| 24 | - name: docs-zip | ||
| 30 | + name: docs-site | ||
| 25 | 31 | path: ./site/ | |
| 26 | - - name: Unzip docs | ||
| 27 | - run: | | ||
| 28 | - cd ./site | ||
| 29 | - unzip docs.zip | ||
| 30 | - rm -f docs.zip | ||
| 31 | 32 | - name: Deploy to Netlify | |
| 33 | + if: steps.download.outputs.found_artifact == 'true' | ||
| 32 | 34 | id: netlify | |
| 33 | - uses: nwtgck/actions-netlify@v1.1.5 | ||
| 35 | + uses: nwtgck/actions-netlify@v2.0.0 | ||
| 34 | 36 | with: | |
| 35 | 37 | publish-dir: './site' | |
| 36 | - production-deploy: false | ||
| 38 | + production-deploy: ${{ github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == 'main' }} | ||
| 37 | 39 | github-token: ${{ secrets.GITHUB_TOKEN }} | |
| 38 | 40 | enable-commit-comment: false | |
| 39 | 41 | env: | |
| 40 | 42 | NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| 41 | 43 | NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| 42 | 44 | - name: Comment Deploy | |
| 45 | + if: steps.netlify.outputs.deploy-url != '' | ||
| 43 | 46 | uses: ./.github/actions/comment-docs-preview-in-pr | |
| 44 | 47 | with: | |
| 45 | 48 | token: ${{ secrets.GITHUB_TOKEN }} | |
| Back | FazBrowse Home | New Git URL |
0 commit comments