-
Notifications
You must be signed in to change notification settings - Fork 244
133 lines (129 loc) · 4.4 KB
/
build-old-docs.yml
File metadata and controls
133 lines (129 loc) · 4.4 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Build old docs
on:
workflow_dispatch:
inputs:
release_token:
description: 'Your release token'
required: true
triggered_by:
description: 'CD | TAG | MANUAL'
required: false
default: MANUAL
package:
description: The name of the repo to build documentation for.
type: string
default: docarray
repo_owner:
description: The owner of the repo to build documentation for. Defaults to 'jina-ai'.
type: string
default: jina-ai
pages_branch:
description: Branch that Github Pages observes
type: string
default: gh-pages
git_config_name:
type: string
default: Jina Dev Bot
git_config_email:
type: string
default: dev-bot@jina.ai
jobs:
token-check:
runs-on: ubuntu-latest
steps:
- name: Check release token
id: token-check
run: |
touch SUCCESS
if: inputs.release_token == env.release_token
env:
release_token: ${{ secrets.DOCARRAY_RELEASE_TOKEN }}
- name: Fail release token
run: |
[[ -f SUCCESS ]]
- name: Get versions
id: get_versions
run: |
printf "versions=" >> $GITHUB_OUTPUT
curl https://raw.githubusercontent.com/${{ inputs.repo_owner }}/${{ inputs.package }}/main/docs/_versions.json >> $GITHUB_OUTPUT
outputs:
versions: ${{ steps.get_versions.outputs.versions }}
build-doc:
needs: token-check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.token-check.outputs.versions) }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
ref: ${{ matrix.version }}
- uses: actions/setup-python@v4
with:
python-version: '3.7'
- name: Get latest templates
run: |
git show --summary
echo "Get latest sidebar brand template"
wget https://raw.githubusercontent.com/${{ inputs.repo_owner }}/${{ inputs.package }}/main/docs/_templates/sidebar/brand.html
mv ./brand.html ./docs/_templates/sidebar/brand.html
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install wheel
# pip does not properly resolve dependency versions with syntax pip install --no-cache-dir ".[test,full]"
pip install --no-cache-dir ".[test]"
pip install --no-cache-dir ".[full]"
pip install --no-cache-dir ".[qdrant]"
pip install --no-cache-dir ".[annlite]"
pip install --no-cache-dir ".[weaviate]"
pip install --no-cache-dir ".[elasticsearch]"
pip install --no-cache-dir ".[redis]"
cd docs
pip install -r requirements.txt
pip install --pre -U furo
pip install sphinx-markdown-tables==0.0.17
- name: Sphinx Build
run: |
cd docs
bash makedoc.sh
- name: Package build into artifact
run: |
mv ./docs/_build/dirhtml ./${{ matrix.version }}
zip -r /tmp/build.zip ./${{ matrix.version }}/*
- name: Upload built html
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.version }}
path: /tmp/build.zip
retention-days: 1
push-docs:
runs-on: ubuntu-latest
needs: build-doc
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
ref: ${{ inputs.pages_branch }}
- uses: actions/download-artifact@v3
with:
path: /tmp/artifacts
- name: Clear old builds
run: |
cd docs
for i in $(ls /tmp/artifacts); do git rm -rf "$i" || true; done
- name: In with new builds
run: |
cd docs
for i in $(ls /tmp/artifacts); do unzip "/tmp/artifacts/$i/build.zip"; done
rm _versions.json || true
wget https://raw.githubusercontent.com/${{ inputs.repo_owner }}/${{ inputs.package }}/main/docs/_versions.json
- name: Push it up!
run: |
git config --local user.email "${{ inputs.git_config_email }}"
git config --local user.name "${{ inputs.git_config_name }}"
git show --summary
git add . && git commit -m "chore(docs): update old docs due to ${{github.event_name}} on ${{github.repository}}"
git push origin