-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (119 loc) · 4.2 KB
/
update_doc.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
name: Update doc
on:
workflow_dispatch:
inputs:
iris-doc-ref:
description: iris-doc repo ref
type: string
required: true
default: 'main'
target_repo:
description: pull request target repo
type: string
required: true
default: 'AgoraIO-Extensions/Agora-Flutter-SDK'
target_branch:
description: pull request target branch
type: string
required: true
default: 'main'
target_branch_name_surffix:
description: The surffix of the branch name, e.g., if doc-update, the branch name become main-doc-update
type: string
required: true
default: 'doc-update'
pull_request_title:
description: The title of the pull request
type: string
required: true
default: '[AUTO] Update doc'
config:
description: The language config
type: string
required: true
default: 'fmt_config/fmt_dart.yaml'
language:
description: The language
type: string
required: true
default: 'dart'
base-template-url:
description: The base template url
type: string
required: true
default: 'https://github.com/AgoraIO/agora_doc_source/releases/download/master-build/flutter_ng_json_template_en.json'
merge-template-url:
description: The template url to merge
type: string
default: ''
export-file-path:
description: The export file path
type: string
required: true
default: 'lib/agora_rtc_engine.dart'
jobs:
update_doc:
name: Updating DOC
runs-on: macos-13
timeout-minutes: 60
steps:
- name: Check out iris_doc
uses: actions/checkout@v3
with:
repository: AgoraIO-Extensions/iris_doc
ref: ${{ inputs.iris-doc-ref }}
path: iris-doc
- name: Check out build project
uses: actions/checkout@v3
with:
token: ${{ secrets.ACTION_PAT }}
repository: ${{ inputs.target_repo }}
ref: ${{ inputs.target_branch }}
path: ${{ inputs.target_repo }}
- uses: subosito/flutter-action@v2
if: ${{ inputs.language == 'dart' }}
with:
channel: 'stable'
- uses: actions/setup-node@v3
if: ${{ inputs.language == 'ts' }}
with:
node-version: '16.x'
- run: npm install -g yarn
if: ${{ inputs.language == 'ts' }}
- name: Run build macos
run: |
BASE_TEMPLATE_URL=${{ inputs.base-template-url }}
MERGE_TEMPLATE_URL=${{ inputs.merge-template-url }}
TEMPLATE_URL_ARGS="--template-url=${BASE_TEMPLATE_URL}"
if [ ! -z "${MERGE_TEMPLATE_URL}" ]; then
TEMPLATE_URL_ARGS="${TEMPLATE_URL_ARGS} --template-url=${MERGE_TEMPLATE_URL}"
fi
TARGET_REPO=${{ inputs.target_repo }}
ROOT_PATH=$(pwd)
EXPORT_FILE_PATH=${ROOT_PATH}/${TARGET_REPO}/${{ inputs.export-file-path }}
cd iris-doc
python3 -m pip install -r requirements.txt
echo ${EXPORT_FILE_PATH}
CONFIG=${{ inputs.config }}
python3 iris_doc.py --config="$ROOT_PATH/iris-doc/$CONFIG" --language=${{ inputs.language }} --export-file-path=${EXPORT_FILE_PATH} ${TEMPLATE_URL_ARGS}
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.ACTION_PAT }}
path: ${{ inputs.target_repo }}
commit-message: ${{ inputs.pull_request_title }}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: "${{ inputs.target_branch }}-${{ inputs.target_branch_name_surffix }}"
base: ${{ inputs.target_branch }}
delete-branch: true
draft: false
title: ${{ inputs.pull_request_title }}
body: |
${{ inputs.pull_request_title }}
doc source: ${{ inputs.base-template-url }}
> This pull request is trigger by bot, do not edit it directly
labels: |
ci:doc