Repository navigation
96 lines (92 loc) · 3.06 KB
/
Copy pathdocs-push.yml
File metadata and controls
96 lines (92 loc) · 3.06 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
name: Update DSPy Docs
on:
push:
branches:
- main
paths:
- "docs/**"
- "dspy/**"
- "pyproject.toml"
- "uv.lock"
pull_request:
paths:
- "docs/**"
- "dspy/**"
- "pyproject.toml"
- "uv.lock"
permissions: {}
jobs:
build-test:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Install dependencies and build
run: |
pip install -r docs/requirements.txt -e .
python docs/scripts/build_docs.py current \
--config docs/mkdocs.yml \
--output docs/site
publish-current:
if: github.event_name == 'push' && github.repository == 'stanfordnlp/dspy'
runs-on: ubuntu-latest
concurrency:
group: dspy-docs-deployment
cancel-in-progress: false
permissions:
contents: read
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: docs/requirements.txt
- name: Install documentation dependencies
run: python -m pip install -r docs/requirements.txt -e .
- name: Build Current documentation
run: |
python docs/scripts/build_docs.py current \
--config docs/mkdocs.yml \
--output current-site
- name: Check out documentation deployment
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: krypticmouse/dspy-docs
ref: master
path: docs-deployment
persist-credentials: false
token: ${{ secrets.GH_PAT }} # zizmor: ignore[secrets-outside-env]
- name: Publish Current through Mike
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
gh auth setup-git
git -C docs-deployment config user.name github-actions
git -C docs-deployment config user.email github-actions@github.com
for attempt in 1 2 3; do
git -C docs-deployment fetch origin master
git -C docs-deployment reset --hard origin/master
python docs/scripts/publish_versioned_docs.py \
--repository docs-deployment \
--site current-site \
--identifier current \
--package-source working-tree \
--branch master \
--require-current-renderer zensical
if git -C docs-deployment push origin master; then
exit 0
fi
sleep $((2 ** attempt + RANDOM % 5))
done
echo "::error::Documentation deployment changed repeatedly; rerun this workflow"
exit 1