Skip to content

angular-docs-jp

angular-docs-jp #1

Workflow file for this run

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 }})"