Sebastián Ramírez
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
30 additions and
1 deletions
-
.github/workflows/build-docs.yml
-
.github/workflows/preview-docs.yml
|
|
@ -4,9 +4,33 @@ on: |
|
|
|
branches: |
|
|
|
- master |
|
|
|
pull_request: |
|
|
|
types: [opened, synchronize] |
|
|
|
types: |
|
|
|
- opened |
|
|
|
- synchronize |
|
|
|
jobs: |
|
|
|
changes: |
|
|
|
runs-on: ubuntu-latest |
|
|
|
# Required permissions |
|
|
|
permissions: |
|
|
|
pull-requests: read |
|
|
|
# Set job outputs to values from filter step |
|
|
|
outputs: |
|
|
|
docs: ${{ steps.filter.outputs.docs }} |
|
|
|
steps: |
|
|
|
- uses: actions/checkout@v3 |
|
|
|
# For pull requests it's not necessary to checkout the code but for master it is |
|
|
|
- uses: dorny/paths-filter@v2 |
|
|
|
id: filter |
|
|
|
with: |
|
|
|
filters: | |
|
|
|
docs: |
|
|
|
- README.md |
|
|
|
- docs/** |
|
|
|
- docs_src/** |
|
|
|
- requirements-docs.txt |
|
|
|
build-docs: |
|
|
|
needs: changes |
|
|
|
if: ${{ needs.changes.outputs.docs == 'true' }} |
|
|
|
runs-on: ubuntu-latest |
|
|
|
steps: |
|
|
|
- name: Dump GitHub context |
|
|
|
|
|
@ -16,19 +16,23 @@ jobs: |
|
|
|
rm -rf ./site |
|
|
|
mkdir ./site |
|
|
|
- name: Download Artifact Docs |
|
|
|
id: download |
|
|
|
uses: dawidd6/action-download-artifact@v2.27.0 |
|
|
|
with: |
|
|
|
if_no_artifact_found: ignore |
|
|
|
github_token: ${{ secrets.FASTAPI_PREVIEW_DOCS_DOWNLOAD_ARTIFACTS }} |
|
|
|
workflow: build-docs.yml |
|
|
|
run_id: ${{ github.event.workflow_run.id }} |
|
|
|
name: docs-zip |
|
|
|
path: ./site/ |
|
|
|
- name: Unzip docs |
|
|
|
if: steps.download.outputs.found_artifact == 'true' |
|
|
|
run: | |
|
|
|
cd ./site |
|
|
|
unzip docs.zip |
|
|
|
rm -f docs.zip |
|
|
|
- name: Deploy to Netlify |
|
|
|
if: steps.download.outputs.found_artifact == 'true' |
|
|
|
id: netlify |
|
|
|
uses: nwtgck/actions-netlify@v2.0.0 |
|
|
|
with: |
|
|
@ -40,6 +44,7 @@ jobs: |
|
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
|
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
|
|
|
- name: Comment Deploy |
|
|
|
if: steps.netlify.outputs.deploy-url != '' |
|
|
|
uses: ./.github/actions/comment-docs-preview-in-pr |
|
|
|
with: |
|
|
|
token: ${{ secrets.FASTAPI_PREVIEW_DOCS_COMMENT_DEPLOY }} |
|
|
|