-
Notifications
You must be signed in to change notification settings - Fork 5k
171 lines (158 loc) · 5.02 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Simple workflow for deploying static content to GitHub Pages
name: Docs
on:
# Runs on pushes targeting the default branch
push:
branches:
- main
pull_request:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-04:
runs-on: ubuntu-latest
strategy:
matrix:
version:
[
{ ref: main, dest-dir: dev },
{ ref: "v0.4.0.dev0", dest-dir: "0.4.0.dev0" },
{ ref: "v0.4.0.dev1", dest-dir: "0.4.0.dev1" },
{ ref: "v0.4.0.dev2", dest-dir: "0.4.0.dev2" },
{ ref: "v0.4.0.dev3", dest-dir: "0.4.0.dev3" },
{ ref: "v0.4.0.dev4", dest-dir: "0.4.0.dev4" },
{ ref: "v0.4.0.dev5", dest-dir: "0.4.0.dev5" },
{ ref: "v0.4.0.dev6", dest-dir: "0.4.0.dev6" },
]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: "true"
ref: ${{ matrix.version.ref }}
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: |
uv sync --locked --all-extras
source .venv/bin/activate
poe --directory ./packages/autogen-core docs-build
mkdir -p docs-staging/${{ matrix.version.dest-dir }}/
mv ./packages/autogen-core/docs/build/* docs-staging/${{ matrix.version.dest-dir }}/
working-directory: ./python
env:
PY_DOCS_DIR: ${{ matrix.version.dest-dir }}/
PY_SWITCHER_VERSION: ${{ matrix.version.dest-dir }}
- uses: actions/upload-artifact@v4
with:
path: "./python/docs-staging"
name: "${{ matrix.version.dest-dir }}-docs"
gen-redirects:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: "true"
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: generate redirects
run: |
mkdir -p python/docs-staging/
python python/packages/autogen-core/docs/redirects/redirects.py python/docs-staging
- uses: actions/upload-artifact@v4
with:
path: "./python/docs-staging"
name: "redirects"
build-02:
runs-on: ubuntu-latest
defaults:
run:
working-directory: website
steps:
- uses: actions/checkout@v4
with:
lfs: true
ref: "0.2"
- uses: actions/setup-node@v4
with:
node-version: 18.x
- name: setup python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: pydoc-markdown install
run: |
python -m pip install --upgrade pip
pip install pydoc-markdown pyyaml termcolor
# Pin databind packages as version 4.5.0 is not compatible with pydoc-markdown.
pip install databind.core==4.4.2 databind.json==4.4.2
- name: pydoc-markdown run
run: |
pydoc-markdown
- name: quarto install
working-directory: ${{ runner.temp }}
run: |
wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.5.23/quarto-1.5.23-linux-amd64.tar.gz
tar -xzf quarto-1.5.23-linux-amd64.tar.gz
echo "$(pwd)/quarto-1.5.23/bin/" >> $GITHUB_PATH
- name: Process notebooks
run: |
python process_notebooks.py render
- name: Build website
run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile --ignore-engines
yarn build
elif [ -e package-lock.json ]; then
npm ci
npm run build
else
npm i --legacy-peer-deps
npm run build
fi
- run: |
mkdir -p artifact/0.2/
cp -r build/* artifact/0.2/
- uses: actions/upload-artifact@v4
with:
path: "website/artifact"
name: "02-docs"
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: [build-02, build-04, gen-redirects]
if: ${{ needs.build-02.result == 'success' && needs.build-04.result == 'success' && needs.gen-redirects.result == 'success' && github.ref == 'refs/heads/main' }}
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Copy 02-docs
run: |
mkdir -p deploy/
for dir in artifacts/*; do
cp -r $dir/* deploy/
done
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./deploy"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4