-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (88 loc) · 3.5 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# 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