-
Notifications
You must be signed in to change notification settings - Fork 8
184 lines (171 loc) · 6.35 KB
/
Copy pathdocumentation.yml
File metadata and controls
184 lines (171 loc) · 6.35 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Documentation Generation Pipeline
on:
workflow_call:
inputs:
coretide_repo:
type: string
description: "GitHub repository (owner/name) to clone CoreTide from"
required: false
default: OpenTideHQ/CoreTide
coretide_path:
type: string
description: "Path where CoreTide needs to be cloned into"
required: false
default: coretide
coretide_ref:
type: string
description: "Ref to clone CoreTide from"
required: false
default: development
python_version:
type: string
description: "Python version to use"
required: false
default: "3.12"
requirements_file:
type: string
description: "Requirements file path"
required: false
default: "coretide/Engines/requirements.txt"
opentide_secrets:
type: string
description: "Content of the OpenTide secrets file"
required: false
wiki_enabled:
type: boolean
description: "Whether to generate the wiki"
required: false
default: false
wiki_repo_owner:
type: string
description: "Organisation or User that owns the Wiki repository to push to"
required: false
default: ""
wiki_repo_name:
type: string
description: "Name of the Wiki repository to push to"
required: false
default: ""
wiki_repo_branch:
type: string
description: "Repo Branch of the Wiki repository to push to"
required: false
default: ""
mdr_changes:
type: string
description: "Whether there are MDR changes in this run, returned from the Validation job"
required: false
default: "false"
secrets:
wiki_token:
description: "Personal Access Token to push to the Wiki repository (use this OR github_app_id/github_app_private_key)"
required: false
github_app_id:
description: "GitHub App ID for generating installation token (alternative to wiki_token)"
required: false
github_app_private_key:
description: "GitHub App Private Key for generating installation token (alternative to wiki_token)"
required: false
jobs:
StagingDocumentation:
name: Staging Documentation Generation
runs-on: ubuntu-latest
concurrency:
group: wiki
cancel-in-progress: false
env:
HAS_GITHUB_APP: ${{ secrets.github_app_id && secrets.github_app_private_key && 'true' || 'false' }}
if: ${{ inputs.wiki_enabled == true && github.event_name == 'pull_request' && inputs.mdr_changes == 'true' }}
steps:
- name: Checkout Tide Instance
uses: actions/checkout@v4
with:
fetch-depth: 100
ref: ${{ github.ref }}
- name: Checkout CoreTide
uses: actions/checkout@v4
with:
repository: ${{ inputs.coretide_repo }}
path: ${{ inputs.coretide_path }}
ref: refs/heads/${{ inputs.coretide_ref }}
- name: Generate GitHub App Token
id: generate_token
if: ${{ env.HAS_GITHUB_APP == 'true' }}
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.github_app_id }}
private-key: ${{ secrets.github_app_private_key }}
owner: ${{ inputs.wiki_repo_owner }}
repositories: ${{ inputs.wiki_repo_name }}
- name: Checkout Wiki
uses: actions/checkout@v4
with:
repository: ${{ inputs.wiki_repo_owner }}/${{ inputs.wiki_repo_name }}
ref: refs/heads/${{ inputs.wiki_repo_branch }}
token: ${{ steps.generate_token.outputs.token || secrets.wiki_token }}
path: ${{ inputs.wiki_repo_name }}
- uses: ./coretide/Pipelines/GitHub/tide-setup
name: Tide Setup
id: tide_setup
with:
python_version: ${{ inputs.python_version }}
requirements_file: ${{ inputs.requirements_file }}
opentide_secrets: ${{ inputs.opentide_secrets }}
- uses: ./coretide/Pipelines/GitHub/documentation-staging
name: Documentation Generation
id: documentation_generation
with:
coretide_path: ${{ inputs.coretide_path }}
wiki_repo_name: ${{ inputs.wiki_repo_name }}
wiki_repo_branch: ${{ inputs.wiki_repo_branch }}
ProductionDocumentation:
name: Documentation Generation
runs-on: ubuntu-latest
concurrency:
group: wiki
cancel-in-progress: false
env:
HAS_GITHUB_APP: ${{ secrets.github_app_id && secrets.github_app_private_key && 'true' || 'false' }}
if: ${{ inputs.wiki_enabled == true && github.ref_name == github.event.repository.default_branch }}
steps:
- name: Checkout Tide Instance
uses: actions/checkout@v4
with:
fetch-depth: 100
ref: ${{ github.ref }}
- name: Checkout CoreTide
uses: actions/checkout@v4
with:
repository: ${{ inputs.coretide_repo }}
path: ${{ inputs.coretide_path }}
ref: refs/heads/${{ inputs.coretide_ref }}
- name: Generate GitHub App Token
id: generate_token
if: ${{ env.HAS_GITHUB_APP == 'true' }}
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.github_app_id }}
private-key: ${{ secrets.github_app_private_key }}
owner: ${{ inputs.wiki_repo_owner }}
repositories: ${{ inputs.wiki_repo_name }}
- name: Checkout Wiki
uses: actions/checkout@v4
with:
repository: ${{ inputs.wiki_repo_owner }}/${{ inputs.wiki_repo_name }}
ref: refs/heads/${{ inputs.wiki_repo_branch }}
path: ${{ inputs.wiki_repo_name }}
token: ${{ steps.generate_token.outputs.token || secrets.wiki_token }}
- name: Tide Setup
uses: ./coretide/Pipelines/GitHub/tide-setup
id: tide_setup
with:
python_version: ${{ inputs.python_version }}
requirements_file: ${{ inputs.requirements_file }}
opentide_secrets: ${{ inputs.opentide_secrets }}
- uses: ./coretide/Pipelines/GitHub/documentation
name: Documentation Generation
id: documentation_generation
with:
coretide_path: ${{ inputs.coretide_path }}
wiki_repo_name: ${{ inputs.wiki_repo_name }}
wiki_repo_branch: ${{ inputs.wiki_repo_branch }}