-
Notifications
You must be signed in to change notification settings - Fork 25
102 lines (99 loc) · 3.31 KB
/
create_search_index.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
name: Create search index
on:
push:
branches:
- main
concurrency:
# Make sure only workflow run at a time for create_search_index.yml
group: ${{ github.workflow }}
jobs:
jekyll:
runs-on: ubuntu-latest
environment: jekyll
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 20
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
working-directory: docs
bundler-cache: true
- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: create_search_index.yml
workflow_conclusion: success
name: jekyll-build
path: docs
if_no_artifact_found: ignore
- name: Extract artifacts
working-directory: docs
run: >
(7z x -o_site/ jekyll-content.zip
&& rm jekyll-content.zip
&& mv _site/.jekyll-metadata ./
&& mv _site/backup-models.json ./
&& mv _site/backup-benchmarking.json ./
&& mv _site/backup-references.json ./)
|| true
- name: Incremental build
id: incremental-build
env:
ELASTICSEARCH_URL: ${{ secrets.ELASTICSEARCH_URL }}
ELASTICSEARCH_ACCESS_TOKEN: ${{ secrets.ELASTICSEARCH_ACCESS_TOKEN }}
ELASTICSEARCH_INDEX_NAME: ${{ secrets.ELASTICSEARCH_INDEX_NAME }}
SEARCH_ORIGIN: ${{ secrets.SEARCH_ORIGIN }}
ORIGIN: ${{ secrets.ORIGIN }}
working-directory: docs
run: |
bundle exec jekyll build --incremental
continue-on-error: ${{ steps.incremental-build.outputs.require_full_build == 'true' }}
- name: Full build
id: full-build
if: ${{ steps.incremental-build.outputs.require_full_build == 'true' }}
env:
ELASTICSEARCH_URL: ${{ secrets.ELASTICSEARCH_URL }}
ELASTICSEARCH_ACCESS_TOKEN: ${{ secrets.ELASTICSEARCH_ACCESS_TOKEN }}
ELASTICSEARCH_INDEX_NAME: ${{ secrets.ELASTICSEARCH_INDEX_NAME }}
SEARCH_ORIGIN: ${{ secrets.SEARCH_ORIGIN }}
ORIGIN: ${{ secrets.ORIGIN }}
working-directory: docs
run: |
rm -f .jekyll-metadata
FULL_BUILD=1 bundle exec jekyll build --incremental
- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
cache-dependency-path: docs/_frontend/yarn.lock
- name: Build frontend
working-directory: docs/_frontend
env:
SEARCH_ORIGIN: ${{ secrets.SEARCH_ORIGIN }}
run: |
yarn
yarn run build
mv static ../_site/
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_site
- name: Zip contents for artifacts
uses: vimtor/action-zip@v1
with:
files: >
./docs/_site/
./docs/.jekyll-metadata
./docs/backup-models.json
./docs/backup-benchmarking.json
./docs/backup-references.json
dest: jekyll-content.zip
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: jekyll-build
path: |
./jekyll-content.zip