-
Notifications
You must be signed in to change notification settings - Fork 196
79 lines (67 loc) · 2.35 KB
/
docs.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
name: Deploy Documentation to Cloudflare R2
# Trigger the workflow on pushes to the main branch
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# 1. Checkout the repository
- uses: actions/checkout@v2
# 2. Set up Python 3.12
- name: Setup Python 3.12
uses: actions/setup-python@v2
with:
python-version: "3.12"
# 3. Cache virtualenv
- name: Cache virtualenv
id: venv-cache
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-3.12
restore-keys: |
venv-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-
venv-${{ runner.os }}-${{ github.job }}-
venv-${{ runner.os }}-
# 4. Install Poetry
- name: Install Poetry
run: python -m pip install poetry
# 5. Cache Poetry and pip dependencies (Optional but recommended)
- name: Cache Poetry and pip
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry
~/.cache/pip
key: poetry-pip-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-pip-${{ runner.os }}-
- name: Install Dependencies with Poetry
run: poetry install --no-interaction --no-ansi
- name: Build Documentation
run: |
cd docs
make html
- name: Install AWS CLI
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
- name: Configure AWS CLI for Cloudflare R2
run: |
aws configure set aws_access_key_id ${{ secrets.CF_R2_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
aws configure set default.region us-east-1 # R2 uses us-east-1 by default
aws configure set default.output json
- name: Sync to Cloudflare R2
env:
CF_R2_ENDPOINT: ${{ secrets.CF_R2_ENDPOINT }}
CF_R2_BUCKET_NAME: ${{ secrets.CF_R2_BUCKET_NAME }}
run: |
aws s3 sync docs/build/html s3://$CF_R2_BUCKET_NAME \
--delete \
--acl public-read \
--endpoint-url $CF_R2_ENDPOINT