-
Notifications
You must be signed in to change notification settings - Fork 2
74 lines (58 loc) · 2.37 KB
/
gh-pages.yaml
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
name: Docs Build and Deploy
on:
workflow_dispatch:
inputs:
version:
description: 'Set sdk version'
required: true
runtime_tag:
description: 'Set runtime tag'
required: true
runtime_version:
description: 'Set runtime version'
default: '3.7'
required: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup Python
uses: actions/[email protected]
with:
python-version: 3.7
- name: Setup poetry
uses: abatilo/[email protected]
####### Get tag, sed version in docs #####
- name: Get latest tag
id: get-latest-tag
uses: actions-ecosystem/action-get-latest-tag@v1
- name: Set VERSION variable
if: github.event.inputs.version == '' && github.event_name == 'workflow_dispatch'
run: echo VERSION=${{ steps.get-latest-tag.outputs.tag }} >> $GITHUB_ENV
- name: Set VERSION variable
if: github.event.inputs.version != '' && github.event_name == 'workflow_dispatch'
run: echo VERSION=${{ github.event.inputs.version }} >> $GITHUB_ENV
- name: Set RUNTIME_VERSION variable
if: github.event.inputs.version != '' && github.event_name == 'workflow_dispatch'
run: echo RUNTIME_VERSION=${{ github.event.inputs.runtime_version }} >> $GITHUB_ENV
- name: Set RUNTIME_TAG variable
if: github.event.inputs.version != '' && github.event_name == 'workflow_dispatch'
run: echo RUNTIME_TAG=${{ github.event.inputs.runtime_tag }} >> $GITHUB_ENV
######## Sed magic time ##########
- name: Sed docs variables
run: |
grep -rl '$sdk_version' docs-src/* | xargs sed -i "s/\$sdk_version/${{ env.VERSION }}/g"
grep -rl '$runtime_version' docs-src/* | xargs sed -i "s/\$runtime_version/${{ env.RUNTIME_VERSION }}/g"
grep -rl '$runtime_tag' docs-src/* | xargs sed -i "s/\$runtime_tag/${{ env.RUNTIME_TAG }}/g"
##################################
- name: Install poetry dependency
run: poetry install
- name: Build sphinx Docs
run: poetry run sphinx-build docs-src/source docs
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs