-
Notifications
You must be signed in to change notification settings - Fork 6
128 lines (108 loc) · 4.25 KB
/
igniteui-react-examples-cd.yml
File metadata and controls
128 lines (108 loc) · 4.25 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
name: IgniteUI React Examples CD
permissions:
contents: write
on:
push:
branches:
- vnext
- master
workflow_dispatch:
inputs:
branch:
description: 'Input a branch name (e.g., vnext)'
required: true
isVerbose:
description: 'Get verbose output from steps - where configurable'
type: boolean
default: false
env:
BRANCH_REF: ${{ github.event.inputs.branch && format('refs/heads/{0}', github.event.inputs.branch) || github.ref }}
jobs:
BuildSamples:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_REF }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
cache-dependency-path: browser/package-lock.json
- name: Create .npmrc file
working-directory: browser
run: |
if [ -f ".npmrc" ]; then
rm .npmrc
fi
touch .npmrc
- name: Configure npm registry
working-directory: browser
run: |
echo "@infragistics:registry=https://packages.infragistics.com/npm/js-licensed/" >> .npmrc
echo "//packages.infragistics.com/npm/js-licensed/:username=${{ secrets.INFRAGISTICS_NPM_USER }}" >> .npmrc
echo "//packages.infragistics.com/npm/js-licensed/:_auth=${{ secrets.INFRAGISTICS_NPM_TOKEN }}" >> .npmrc
- name: Replace references to IG trial packages with licensed ones in package.json
working-directory: browser
shell: pwsh
run: |
$packageJson = Get-Content -Raw ./package.json | ConvertFrom-Json
$properties = $packageJson.dependencies.PSObject.Properties `
| where-object { $_.Name.StartsWith("igniteui-react") -or $_.Name.StartsWith("igniteui-dockmanager") }
foreach( $property in $properties )
{
$oldName = $property.Name;
$newName = "@infragistics/" + $oldName
# remember the current value of the old property
$value = $property.Value;
# remove reference to the trial package reference
$packageJson.dependencies.psobject.Properties.Remove($oldName);
# add reference to the licensed package reference
$packageJson.dependencies | Add-Member -NotePropertyName $newName -NotePropertyValue $value;
}
ConvertTo-Json -InputObject $packageJson | Set-Content -Path ./package.json
- name: npm install
working-directory: browser
run: npm install
- name: Replace references to IG trial packages with licensed ones in TSX files
shell: pwsh
run: |
Get-ChildItem -Include "*.tsx","*.ts" -Recurse | `
ForEach { (Get-Content $_.PSPath | ForEach { ($_ -replace '(from|import)\s?[''"](igniteui-(react|dockmanager).*)[''"]', '$1 "@infragistics/$2"') }) | `
Set-Content $_.PSPath }
- name: npm run build
working-directory: browser
run: npm run build
- name: Package samples browser
run: |
cd browser/build
zip -r ${{ github.workspace }}/react-demos.zip ./
- name: Publish pipeline artifact
uses: actions/upload-artifact@v4
with:
name: react-demos-artifact
path: react-demos.zip
- name: Trigger Deploy Workflow in IgniteUI Actions
uses: actions/github-script@v8
with:
github-token: ${{ secrets.CLASSIC_PAT_GITHUB }}
script: |
await github.rest.repos.createDispatchEvent({
owner: 'IgniteUI',
repo: 'igniteui-actions',
event_type: 'igniteui-samples-cd',
client_payload: {
calling_branch: "${{ env.BRANCH_REF }}",
repository: "${{ github.repository }}",
run_id: "${{ github.run_id }}",
artifact_name: "react-demos-artifact",
base_href: "react-demos",
submodule_dir: "react-demos",
ref: "${{ github.ref }}",
sha: "${{ github.sha }}",
branch: '${{ github.ref_name }}',
}
});