-
Notifications
You must be signed in to change notification settings - Fork 1
110 lines (93 loc) · 2.77 KB
/
docs.yml
File metadata and controls
110 lines (93 loc) · 2.77 KB
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
109
110
name: Documentation
on:
push:
branches: [master, main]
paths:
- 'docs/**'
- 'contree_cli/**'
- '.github/workflows/docs.yml'
pull_request:
branches: [master, main]
paths:
- 'docs/**'
- 'contree_cli/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
env:
DEFAULT_PYTHON: "3.12"
FORCE_COLOR: "1"
jobs:
build:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python
run: uv python install ${{ env.DEFAULT_PYTHON }}
- name: Cache venv
id: cache-venv
uses: actions/cache@v5
with:
path: .venv
key: venv-docs-${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ hashFiles('uv.lock') }}
- name: Install dependencies
run: uv sync --group docs
- name: Build HTML documentation
run: |
cd docs
uv run sphinx-build -b html -W --keep-going . _build/html
- name: Upload documentation artifact
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/_build/html
retention-days: 7
linkcheck:
name: Check Links
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python
run: uv python install ${{ env.DEFAULT_PYTHON }}
- name: Cache venv
id: cache-venv
uses: actions/cache@v5
with:
path: .venv
key: venv-docs-${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ hashFiles('uv.lock') }}
- name: Install dependencies
run: uv sync --group docs
- name: Check external links
run: |
cd docs
uv run sphinx-build -b linkcheck . _build/linkcheck || true
cat _build/linkcheck/output.txt || true
deploy:
name: Deploy to S3
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Download documentation artifact
uses: actions/download-artifact@v4
with:
name: documentation
path: docs/_build/html
- name: Sync to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_ENDPOINT_URL: ${{ secrets.AWS_ENDPOINT_URL }}
AWS_BUCKET: ${{ secrets.AWS_BUCKET }}
run: |
aws s3 sync docs/_build/html "s3://${AWS_BUCKET}/cli/" --delete