Skip to content

Workflow file for this run

# 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
- uses: hynek/setup-cached-uv@v2
- uses: actions/setup-node@v2
- name: Setup Pages
uses: actions/configure-pages@v2
# Install dependencies
- name: Install Python dependencies with uv
run: uv pip install -r requirements.txt --system
# This lets us encrypt a page with a password
- name: Install staticrypt
run: |
npm install -g staticrypt
# 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
- name: Download latest Github data
run: python book/scripts/download_github_data.py
env:
TOKEN_GITHUB_READONLY: ${{ secrets.TOKEN_GITHUB_API_READONLY }}
# Build the site
- name: Build the Sphinx site
run: sphinx-build -v -b dirhtml book book/_build/dirhtml
env:
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }}
GH_TOKEN: ${{ secrets.TOKEN_GITHUB_API_READONLY }}
# Encrypt pages that are only meant for team consumption
- name: Encrypt some pages
run: |
staticrypt book/_build/dirhtml/people/index.html -p ${{ secrets.STATICRYPT_PASSWORD }} -d book/_build/dirhtml/people/ --short --template-color-primary "#1D4EF5" --template-title "Only for the 2i2c team!" --template-instructions "Check the team BitWarden for the password...";
staticrypt book/_build/dirhtml/finances/index.html -p ${{ secrets.STATICRYPT_PASSWORD }} -d book/_build/dirhtml/finances/ --short --template-color-primary "#1D4EF5" --template-title "Only for the 2i2c team!" --template-instructions "Check the team BitWarden for the password...";
# Upload artifact for looking at later
- uses: actions/upload-artifact@v4
if: always()
with:
# Upload entire build output
path: 'book/_build/'
# Upload to GH Pages
- name: Upload artifact for GH pages
uses: actions/upload-pages-artifact@v1
if: always()
with:
# Upload the HTML folder
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