forked from IgniteUI/igniteui-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
332 lines (294 loc) · 15.4 KB
/
Copy pathbuild-docs-jp.yml
File metadata and controls
332 lines (294 loc) · 15.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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
name: angular-docs-jp
# Equivalent to Azure DevOps CI trigger: refs/tags/*
# NOTE: This workflow runs inside the JP docs repository.
# It clones igniteui-angular at the resolved branch/tag, copies the JP docs
# assets (typedoc/sassdoc) from this repo into the clone's i18nRepo/ folder,
# and then runs all npm commands inside the clone.
on:
push:
tags:
- '*'
# Allows manual runs with queue-time variable equivalents (same as ADO).
workflow_dispatch:
inputs:
igniteuiAngularBranch:
description: 'igniteui-angular branch/tag to clone (leave empty to auto-detect from current tag)'
required: false
default: ''
isLatest:
description: 'Override isLatest flag (leave empty to auto-detect)'
required: false
default: ''
skipDeployment:
description: 'Skip deployment (for testing only)'
required: false
type: boolean
default: false
jobs:
build-docs:
runs-on: ubuntu-latest
outputs:
productionDeployment: ${{ steps.check-deployment.outputs.productionDeployment }}
runDeployment: ${{ steps.set-deploy-flag.outputs.runDeployment }}
steps:
# -----------------------------------------------------------------------
# Checkout the JP docs repository (this repo).
- name: Checkout JP docs repository
uses: actions/checkout@v4
with:
# Full history needed for git ls-remote tag sorting and git describe
fetch-depth: 0
# -----------------------------------------------------------------------
# Resolve whether deployment should run.
# On a tag push, inputs is empty so skipDeployment is '' — deploy runs.
# On workflow_dispatch, deploy runs unless skipDeployment checkbox is checked.
- name: Set deployment flag
id: set-deploy-flag
shell: pwsh
run: |
$skip = '${{ inputs.skipDeployment }}' -eq 'true'
$run = if ($skip) { 'false' } else { 'true' }
Write-Host "runDeployment: $run"
echo "runDeployment=$run" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
# -----------------------------------------------------------------------
# Equivalent to: NodeTool@0 — Use Node 20.19.x
- name: Use Node 20.19.x
uses: actions/setup-node@v4
with:
node-version: '20.19.x'
# -----------------------------------------------------------------------
# Equivalent to: DutchWorkzToolsAllVariables@1 — show all build variables.
# In the JP ADO pipeline this was step 2, immediately after NodeTool.
- name: Show all build variables
shell: pwsh
run: |
Write-Host '=== Environment Variables ==='
Get-ChildItem Env: | Sort-Object Name | Format-Table Name, Value -AutoSize
# -----------------------------------------------------------------------
# Generate a build version once, before NuGet pack steps.
# ADO used build.buildnumber (e.g. "AngularDocs_20240101.1") and split on '_'.
# GitHub Actions equivalent uses a date + run_number format.
- name: Set BuildVersion
shell: pwsh
run: |
$buildDate = Get-Date -Format "yyyyMMdd"
$version = "$buildDate.${{ github.run_number }}"
Write-Host "BuildVersion: $version"
echo "BuildVersion=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# -----------------------------------------------------------------------
# Equivalent to: DeleteFiles@1 — Delete *.nupkg and the igniteui-angular clone dir.
- name: Delete files (*.nupkg, igniteui-angular clone)
shell: pwsh
run: |
Get-ChildItem -Path '${{ github.workspace }}' -Filter '*.nupkg' -File |
Remove-Item -Force -ErrorAction SilentlyContinue
if (Test-Path '${{ github.workspace }}/igniteui-angular') {
Remove-Item '${{ github.workspace }}/igniteui-angular' -Recurse -Force
}
# -----------------------------------------------------------------------
# Equivalent to: 'Extract the tag from repo' powershell step.
# When triggered by a tag push, github.ref_name already contains the tag name.
# Also resolves igniteuiAngularBranch: falls back to curTag when not provided,
# matching the ADO pipeline's: if(-not "$(igniteuiAngularBranch)") { set to $tag }
- name: Extract the tag and resolve igniteuiAngularBranch
shell: pwsh
run: |
$fullTag = '${{ github.ref_name }}'
$split = $fullTag -split '-'
$tag = $split[0]
Write-Host "curTag: $tag"
Write-Host "fullTag: $fullTag"
echo "curTag=$tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "fullTag=$fullTag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Resolve igniteuiAngularBranch — use the manual input when provided,
# otherwise default to the current tag (same logic as ADO queue-time variable).
$angularBranch = '${{ inputs.igniteuiAngularBranch }}'
if (-not $angularBranch) { $angularBranch = $tag }
Write-Host "igniteuiAngularBranch: $angularBranch"
echo "igniteuiAngularBranch=$angularBranch" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# -----------------------------------------------------------------------
# Equivalent to: ADO pipeline variable variables: isLatest: 'true'
# JP pipeline hardcodes isLatest=true; the workflow_dispatch input allows
# overriding it at queue time (same as changing the ADO variable before queuing).
- name: Set isLatest
shell: pwsh
run: |
$value = '${{ inputs.isLatest }}'
if (-not $value) { $value = 'true' }
Write-Host "isLatest: $value"
echo "isLatest=$value" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# -----------------------------------------------------------------------
# Equivalent to: script — clone igniteui-angular at the resolved branch/tag.
# In ADO this ran from Build.SourcesDirectory (the JP docs repo root),
# producing a sibling "igniteui-angular" folder — replicated exactly here.
- name: Clone igniteui-angular
run: |
git clone https://github.com/IgniteUI/igniteui-angular "igniteui-angular" \
-b "${{ env.igniteuiAngularBranch }}" --depth 1
working-directory: ${{ github.workspace }}
# -----------------------------------------------------------------------
# Equivalent to: Npm@1 — npm cache clean --force (in cloned repo)
- name: npm cache clean --force
run: npm cache clean --force
working-directory: ${{ github.workspace }}/igniteui-angular
# Equivalent to: Npm@1 — npm ci (in cloned repo)
- name: npm ci
run: npm ci --force
working-directory: ${{ github.workspace }}/igniteui-angular
# Equivalent to: Npm@1 — npm run build:lib (in cloned repo)
- name: npm run build:lib
run: npm run build:lib
working-directory: ${{ github.workspace }}/igniteui-angular
# -----------------------------------------------------------------------
# JP-specific: Copy typedoc/sassdoc assets FROM this JP docs repo
# INTO the cloned igniteui-angular's i18nRepo/ folder.
# Equivalent to the two CopyFiles@2 tasks that copy:
# $(Build.SourcesDirectory)\typedoc → igniteui-angular\i18nRepo\typedoc
# $(Build.SourcesDirectory)\sassdoc → igniteui-angular\i18nRepo\sassdoc
- name: Copy typedoc assets to igniteui-angular/i18nRepo
shell: pwsh
run: |
$target = '${{ github.workspace }}/igniteui-angular/i18nRepo/typedoc'
New-Item -ItemType Directory -Force -Path $target | Out-Null
if (Test-Path '${{ github.workspace }}/typedoc') {
Copy-Item -Path '${{ github.workspace }}/typedoc/*' -Destination $target -Recurse -Force
}
- name: Copy sassdoc assets to igniteui-angular/i18nRepo
shell: pwsh
run: |
$target = '${{ github.workspace }}/igniteui-angular/i18nRepo/sassdoc'
New-Item -ItemType Directory -Force -Path $target | Out-Null
if (Test-Path '${{ github.workspace }}/sassdoc') {
Copy-Item -Path '${{ github.workspace }}/sassdoc/*' -Destination $target -Recurse -Force
}
# -----------------------------------------------------------------------
# ---- STAGING DOCS BUILD ---------------------------------------------
# -----------------------------------------------------------------------
# Equivalent to: Npm@1 — npm run build:typedoc:ja:staging
- name: npm run build:typedoc (staging)
run: npm run build:typedoc:ja:staging
working-directory: ${{ github.workspace }}/igniteui-angular
# Equivalent to: Npm@1 — npm run build:sassdoc:ja:staging
- name: npm run build:sassdoc (staging)
run: npm run build:sassdoc:ja:staging
working-directory: ${{ github.workspace }}/igniteui-angular
# Equivalent to: powershell — patch angularDocsPostDeploy.ps1 with branch/isLatest values,
# then CopyFiles@2 + rename — all operating inside the cloned igniteui-angular folder.
# Note: ADO replaces VariableValue with igniteuiAngularBranch (not curTag).
- name: Update PostDeploy.ps1 vars (staging)
shell: pwsh
run: |
$filePath = '${{ github.workspace }}/igniteui-angular/angularDocsPostDeploy.ps1'
((Get-Content -Path $filePath -Raw) -replace 'VariableValue', "$env:igniteuiAngularBranch") |
Set-Content -Path $filePath
((Get-Content -Path $filePath -Raw) -replace 'VariableIsLatest', "$env:isLatest") |
Set-Content -Path $filePath
- name: Copy angularDocsPostDeploy.ps1 to dist (staging)
shell: pwsh
run: |
$targetDir = '${{ github.workspace }}/igniteui-angular/dist/igniteui-angular/docs'
New-Item -ItemType Directory -Force -Path $targetDir | Out-Null
Copy-Item -Path '${{ github.workspace }}/igniteui-angular/angularDocsPostDeploy.ps1' `
-Destination $targetDir -Force
- name: Rename PostDeploy.ps1 (staging)
shell: pwsh
run: |
Rename-Item `
-Path '${{ github.workspace }}/igniteui-angular/dist/igniteui-angular/docs/angularDocsPostDeploy.ps1' `
-NewName 'PostDeploy.ps1'
# Upload the staging docs as a workflow artifact for the deploy job
- name: Upload staging artifact
uses: actions/upload-artifact@v4
with:
name: angularDocsJP-staging
path: igniteui-angular/dist/igniteui-angular/docs/
# -----------------------------------------------------------------------
# ---- PRODUCTION DOCS BUILD ------------------------------------------
# -----------------------------------------------------------------------
# Equivalent to: Npm@1 — npm run build:typedoc:ja:production
- name: npm run build:typedoc (production)
run: npm run build:typedoc:ja:production
working-directory: ${{ github.workspace }}/igniteui-angular
# Equivalent to: Npm@1 — npm run build:sassdoc:ja:production
- name: npm run build:sassdoc (production)
run: npm run build:sassdoc:ja:production
working-directory: ${{ github.workspace }}/igniteui-angular
# Equivalent to: DeleteFiles@1 — Delete PostDeploy.ps1 from dist (prod re-uses same dist dir)
- name: Delete PostDeploy.ps1 from dist folder
shell: pwsh
run: |
Remove-Item `
-Path '${{ github.workspace }}/igniteui-angular/dist/igniteui-angular/docs/PostDeploy.ps1' `
-Force -ErrorAction SilentlyContinue
# Equivalent to: CopyFiles@2 + rename — prod variant uses isLatestProd.
# Note: ADO replaces VariableValue with igniteuiAngularBranch (not curTag).
- name: Copy angularDocsPostDeploy.ps1 to dist (production)
shell: pwsh
run: |
Copy-Item -Path '${{ github.workspace }}/igniteui-angular/angularDocsPostDeploy.ps1' `
-Destination '${{ github.workspace }}/igniteui-angular/dist/igniteui-angular/docs' -Force
- name: Update PostDeploy.ps1 vars (production)
shell: pwsh
run: |
$filePath = '${{ github.workspace }}/igniteui-angular/dist/igniteui-angular/docs/angularDocsPostDeploy.ps1'
((Get-Content -Path $filePath -Raw) -replace 'VariableValue', "$env:igniteuiAngularBranch") |
Set-Content -Path $filePath
((Get-Content -Path $filePath -Raw) -replace 'VariableIsLatest', "$env:isLatest") |
Set-Content -Path $filePath
- name: Rename PostDeploy.ps1 (production)
shell: pwsh
run: |
Rename-Item `
-Path '${{ github.workspace }}/igniteui-angular/dist/igniteui-angular/docs/angularDocsPostDeploy.ps1' `
-NewName 'PostDeploy.ps1'
# Upload the production docs as a workflow artifact for the deploy job
- name: Upload production artifact
uses: actions/upload-artifact@v4
with:
name: angularDocsJP-production
path: igniteui-angular/dist/igniteui-angular/docs/
# -----------------------------------------------------------------------
# Determine whether this tag is production-eligible (no alpha/beta/rc suffix).
# Result is exposed as a job output so the deploy-production job can condition on it.
- name: Check tag and set ProductionDeployment variable
id: check-deployment
shell: pwsh
run: |
$branchName = "${{ github.ref_name }}".ToLower()
$shouldDeploy = -not $branchName.Contains('alpha') `
-and -not $branchName.Contains('beta') `
-and -not $branchName.Contains('rc')
Write-Host "ProductionDeployment: $shouldDeploy"
echo "productionDeployment=$shouldDeploy" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
# ---------------------------------------------------------------------------
# Deploy staging docs to IIS via MSDeploy.
# TODO: restore 'uses: IgniteUI/igniteui-actions/.github/workflows/deploy.yml@master'
# once cross-repo access is confirmed.
deploy-staging:
needs: build-docs
if: needs.build-docs.outputs.runDeployment == 'true'
runs-on: ubuntu-latest
steps:
- name: Download staging artifact
uses: actions/download-artifact@v4
with:
name: angularDocsJP-staging
path: dist/igniteui-angular/docs/
- name: Deploy staging (placeholder)
run: echo "TODO - deploy staging artifact to IIS (run-id ${{ github.run_id }})"
# ---------------------------------------------------------------------------
# Deploy production docs — only on CI push of a non-pre-release tag.
# TODO: restore 'uses: IgniteUI/igniteui-actions/.github/workflows/deploy.yml@master'
# once cross-repo access is confirmed.
deploy-production:
needs: build-docs
if: github.event_name == 'push' && needs.build-docs.outputs.productionDeployment == 'True'
runs-on: ubuntu-latest
steps:
- name: Download production artifact
uses: actions/download-artifact@v4
with:
name: angularDocsJP-production
path: dist/igniteui-angular/docs/
- name: Deploy production (placeholder)
run: echo "TODO - deploy production artifact to IIS (run-id ${{ github.run_id }})"