Skip to content

Commit 5545fc0

Browse files
committed
Add self-hosted docs
1 parent 04e4968 commit 5545fc0

File tree

4 files changed

+73
-18
lines changed

4 files changed

+73
-18
lines changed

.github/workflows/docs.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Setup Python 3.12
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: "3.12"
18+
- name: Cache virtualenv
19+
id: venv-cache
20+
uses: actions/cache@v3
21+
with:
22+
path: .venv
23+
key: venv-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-3.12
24+
restore-keys: |
25+
venv-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-
26+
venv-${{ runner.os }}-${{ github.job }}-
27+
venv-${{ runner.os }}-
28+
- name: Install Poetry
29+
run: python -m pip install poetry
30+
- name: Cache Poetry and pip
31+
uses: actions/cache@v3
32+
with:
33+
path: |
34+
~/.cache/pypoetry
35+
~/.cache/pip
36+
key: poetry-pip-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
37+
restore-keys: |
38+
poetry-pip-${{ runner.os }}-
39+
- name: Install Dependencies with Poetry
40+
run: poetry install --no-interaction --no-ansi
41+
- name: Build Documentation
42+
run: |
43+
poetry run make build-docs
44+
- name: Install AWS CLI
45+
run: |
46+
sudo apt update
47+
sudo apt install -y awscli
48+
- name: Configure AWS CLI for Cloudflare R2
49+
run: |
50+
aws configure set aws_access_key_id ${{ secrets.CF_R2_ACCESS_KEY_ID }}
51+
aws configure set aws_secret_access_key ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
52+
aws configure set default.region us-east-1 # R2 uses us-east-1 by default
53+
aws configure set default.output json
54+
- name: Sync to Cloudflare R2
55+
env:
56+
CF_R2_ENDPOINT: ${{ secrets.CF_R2_ENDPOINT }}
57+
CF_R2_BUCKET_NAME: ${{ secrets.CF_R2_BUCKET_NAME }}
58+
run: |
59+
aws s3 sync docs/build/en/html s3://$CF_R2_BUCKET_NAME/en/ \
60+
--delete \
61+
--acl public-read \
62+
--endpoint-url $CF_R2_ENDPOINT
63+
aws s3 sync docs/build/ru/html s3://$CF_R2_BUCKET_NAME/ru/ \
64+
--delete \
65+
--acl public-read \
66+
--endpoint-url $CF_R2_ENDPOINT

.readthedocs.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ translate: .venv
5454
sphinx-intl update -p docs/build/gettext -l ru -d docs/source/locale
5555

5656

57-
docs: translate
57+
build-docs: translate
5858
make -C docs/ -e BUILDDIR="build/en" html
5959
make -C docs/ -e SPHINXOPTS="-D language='ru'" -e BUILDDIR="build/ru" html
60+
61+
docs: build-docs
6062
python -m webbrowser -t "file://$(shell pwd)/docs/build/en/html/index.html"
6163
python -m webbrowser -t "file://$(shell pwd)/docs/build/ru/html/index.html"

docs/source/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@
5555
"sphinx.ext.doctest",
5656
"sphinx.ext.coverage",
5757
"sphinx.ext.viewcode",
58+
"sphinxcontrib.googleanalytics",
5859
]
5960

61+
googleanalytics_id = "G-LKL5Q0MGWZ"
62+
googleanalytics_enabled = True
63+
6064
# Add any paths that contain templates here, relative to this directory.
6165
templates_path = ["_templates"]
6266

0 commit comments

Comments
 (0)