-
Notifications
You must be signed in to change notification settings - Fork 237
90 lines (85 loc) · 2.67 KB
/
force-docs-build.yml
File metadata and controls
90 lines (85 loc) · 2.67 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
name: Manual Docs Build
on:
workflow_dispatch:
inputs:
release_token:
description: 'Your release token'
required: true
triggered_by:
description: 'CD | TAG | MANUAL'
required: false
default: MANUAL
build_old_docs:
description: 'Whether to build old docs (TRUE | FALSE)'
type: string
default: 'FALSE'
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 ]]
build-and-push-latest-docs:
needs: token-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
python -m poetry config virtualenvs.create false && python -m poetry install --no-interaction --no-ansi --all-extras
- name: docs Build
run: |
cd docs
bash makedocs.sh
cd ..
- name: docs Build
run: |
rm -rf docs
mv site /tmp/tmp_docs
- name: Checkout to GH pages branch (${{ inputs.pages_branch }})
run: |
git fetch origin ${{ inputs.pages_branch }}:${{ inputs.pages_branch }} --depth 1
git checkout -f ${{ inputs.pages_branch }}
git reset --hard HEAD
rm -rf docs
mv /tmp/tmp_docs docs
- 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 ./docs && git commit -m "chore(docs): update docs due to ${{github.event_name}} on ${{github.repository}}"
git push origin ${{ inputs.pages_branch }}