-
Notifications
You must be signed in to change notification settings - Fork 0
222 lines (191 loc) · 6.82 KB
/
build_website.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Build and deploy BEHAVIOR website
on:
schedule:
- cron: "0 10 * * *" # Every day at 10am
workflow_dispatch:
push:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
jobs:
build-omnigibson-docs:
runs-on: [self-hosted, linux]
strategy:
matrix:
branch: [main, og-develop]
defaults:
run:
shell: micromamba run -n omnigibson /bin/bash -leo pipefail {0}
steps:
- name: Fix home
run: echo "HOME=/root" >> $GITHUB_ENV
- name: Checkout source
uses: actions/checkout@v4
with:
repository: StanfordVL/OmniGibson
ref: ${{ matrix.branch }}
submodules: true
path: omnigibson-src
- name: Install
working-directory: omnigibson-src
run: pip install -e .[dev]
- name: Install dev dependencies if they exist (backwards compatibility w/ main branch)
working-directory: omnigibson-src
run: "[ ! -f requirements-dev.txt ] || pip install -r requirements-dev.txt"
- name: Build docs
working-directory: omnigibson-src
run: source scripts/build_docs.sh
- name: Zip artifact for deployment
working-directory: omnigibson-src/site
run: apt update && apt install -y zip && zip -r ${GITHUB_WORKSPACE}/omnigibson-docs-${{ matrix.branch }}.zip *
- name: Deploy artifact
uses: actions/upload-artifact@v4
with:
name: omnigibson-docs-${{ matrix.branch }}
path: omnigibson-docs-${{ matrix.branch }}.zip
build-knowledgebase:
runs-on: ubuntu-latest
steps:
# Checkout all repos
- name: Checkout website repo
uses: actions/checkout@v3
with:
path: website
- name: Clone BDDL Repo
uses: actions/checkout@v3
with:
repository: StanfordVL/bddl
path: bddl
ref: develop
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: "3.10"
architecture: x64
# See if we need to rebuild the whole thing
- name: Get BDDL hash
id: bddl-hash
working-directory: bddl
run: echo hash=$(git rev-parse HEAD) >> "$GITHUB_OUTPUT"
- name: Get website hash
id: website-hash
working-directory: website
run: echo hash=$(git rev-parse HEAD) >> "$GITHUB_OUTPUT"
- name: Check cache for overall data
id: cache-knowledgebase
uses: actions/cache@v3
with:
key: knowledgebase-${{ steps.website-hash.outputs.hash }}-${{ steps.bddl-hash.outputs.hash }}
path: README.md
lookup-only: true
# Rebuild if necessary
- if: ${{ steps.cache-knowledgebase.outputs.cache-hit != 'true' }}
name: Install BDDL
working-directory: bddl
run: pip install -e .
- if: ${{ steps.cache-knowledgebase.outputs.cache-hit != 'true' }}
name: Install other dependencies
working-directory: website/knowledgebase
run: pip install -r requirements.txt
- if: ${{ steps.cache-knowledgebase.outputs.cache-hit != 'true' }}
name: Start local server
working-directory: website/knowledgebase
run: flask --app knowledgebase.app run &
- if: ${{ steps.cache-knowledgebase.outputs.cache-hit != 'true' }}
name: Wait for server to come alive
working-directory: website/knowledgebase
run: curl --head -X GET --retry 20 --retry-connrefused --retry-delay 5 http://localhost:5000/knowledgebase/
- if: ${{ steps.cache-knowledgebase.outputs.cache-hit != 'true' }}
name: Freeze static files
working-directory: website/knowledgebase
run: wget -mpEk http://localhost:5000/knowledgebase/ && wget -P localhost:5000/knowledgebase/ http://localhost:5000/knowledgebase/searchable_items.json
- name: Kill local server
if: success() || failure()
run: kill $(lsof -t -i:5000) || true
- name: Zip artifact for deployment
working-directory: website/knowledgebase/localhost:5000/knowledgebase
run: zip -r ${GITHUB_WORKSPACE}/knowledgebase.zip *
- if: ${{ steps.cache-knowledgebase.outputs.cache-hit != 'true' }}
name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: knowledgebase
path: knowledgebase.zip
build-jekyll:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: jekyll
ruby-version: '3.1' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Build with Jekyll
# Outputs to the './_site' directory by default
working-directory: jekyll
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Zip artifact for deployment
working-directory: jekyll/_site
run: zip -r ${GITHUB_WORKSPACE}/jekyll.zip *
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: jekyll
path: jekyll.zip
# Combine different artifacts into a single github pages artifact
combine-artifacts:
runs-on: ubuntu-latest
needs: [build-omnigibson-docs, build-knowledgebase, build-jekyll]
steps:
- name: Pull jekyll
uses: actions/download-artifact@v4
with:
name: jekyll
path: .
- name: Pull main docs
uses: actions/download-artifact@v4
with:
name: omnigibson-docs-main
path: .
- name: Pull og-develop docs
uses: actions/download-artifact@v4
with:
name: omnigibson-docs-og-develop
path: .
- name: Pull knowledgebase
uses: actions/download-artifact@v4
with:
name: knowledgebase
path: .
- name: Unpack everything
run: >
unzip jekyll.zip -d _site &&
unzip omnigibson-docs-main.zip -d _site/omnigibson &&
unzip omnigibson-docs-og-develop.zip -d _site/omnigibson-develop &&
unzip knowledgebase.zip -d _site/knowledgebase
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
# Deploy on github pages
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: combine-artifacts
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4