Deploy static content to Pages #618
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deploy the documentation to GH pages automatically. | |
# ref: https://github.blog/changelog/2022-07-27-github-pages-custom-github-actions-workflows-beta/ | |
name: Deploy static content to Pages | |
on: | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Run every day to get the latest data | |
schedule: | |
- cron: '0 1 * * *' | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
# Single deploy job since we're just deploying | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-python@v2 | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
# Install dependencies | |
- run: pip install -r requirements.txt | |
# Download the latest AirTable community data | |
- run: python book/scripts/download_airtable_data.py | |
env: | |
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }} | |
# Download hub activity data from Grafana | |
- name: Load hub activity from grafana | |
env: | |
GRAFANA_TOKEN: ${{ secrets.GRAFANA_TOKEN }} | |
run: python book/scripts/download_grafana_activity.py | |
# Download the latest GitHub data | |
- run: python book/scripts/download_github_data.py | |
env: | |
TOKEN_GITHUB_READONLY: ${{ secrets.TOKEN_GITHUB_API_READONLY }} | |
# Build the site | |
- run: sphinx-build -b dirhtml book book/_build/dirhtml | |
env: | |
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }} | |
# Upload to GH Pages | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload entire repository | |
path: 'book/_build/dirhtml' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |
- name: Upload Logs and Build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sphinx-logs | |
path: book/_build |