mirror of
https://github.com/fastapi/fastapi.git
synced 2026-02-24 02:38:13 -05:00
🚀 Preview docs for external PRs (#1738)
* 🍱 Save docs zip when building docs * 🙈 Add docs.zip artifact to .gitignore * 🚀 Update deploy artifact name * ♻️ Upload artifact directory * ✨ Add WIP trigger docs preview * ♻️ Update trigger docs preview * 👷 Update env vars for docs preview * 👷 Update PR extraction * 👷 Try to show GitHub event * 💚 Try to see if GitHub context templates is causing the problem * 💚 Try to debug context GitHub event * 🔊 Debug GitHub event context * 👷 Update debugging action * 👷 Update debug * 👷 Update Action * ♻️ Update script to trigger docs preview * ⚡️ Try to use Zip again to improve speed * 🔧 Update zip scripts * ✨ Add preview docs on event * 🚀 Trigger deploy preview on PRs * 🐛 Fix trigger script env vars
This commit is contained in:
committed by
GitHub
parent
b7251f1654
commit
4dd386b807
@@ -1,4 +1,4 @@
|
||||
name: Build and Deploy to Netlify
|
||||
name: Build Docs
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
@@ -18,6 +18,18 @@ jobs:
|
||||
run: python3.7 -m flit install --extras doc
|
||||
- name: Build Docs
|
||||
run: python3.7 ./scripts/docs.py build-all
|
||||
- name: Zip docs
|
||||
run: bash ./scripts/zip-docs.sh
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: docs-zip-${{ github.sha }}
|
||||
path: ./docs.zip
|
||||
- name: Trigger Docs Preview
|
||||
env:
|
||||
PR: "${{ github.event.number }}"
|
||||
NAME: "docs-zip-${{ github.sha }}"
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run: bash ./scripts/trigger-docs-preview.sh
|
||||
- name: Deploy to Netlify
|
||||
uses: nwtgck/actions-netlify@v1.0.3
|
||||
with:
|
||||
37
.github/workflows/preview-docs.yml
vendored
Normal file
37
.github/workflows/preview-docs.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Deploy Docs
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
pr:
|
||||
description: Pull Request number
|
||||
required: true
|
||||
name:
|
||||
description: Artifact name for zip file with docs
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: ${{ github.event.inputs.name }}
|
||||
path: ./docs.zip
|
||||
- name: Unzip docs
|
||||
run: bash ./scripts/unzip-docs.sh
|
||||
- name: Deploy to Netlify
|
||||
id: netlify
|
||||
uses: nwtgck/actions-netlify@v1.0.3
|
||||
with:
|
||||
publish-dir: './site'
|
||||
production-deploy: false
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
- name: Comment Deploy
|
||||
run: bash ./scripts/docs-comment-deploy.sh
|
||||
env:
|
||||
PR: "${{ github.event.inputs.pr }}"
|
||||
DEPLOY_URL: "${{ steps.netlify.outputs.deploy-url }}"
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
Reference in New Issue
Block a user