-
Notifications
You must be signed in to change notification settings - Fork 22
218 lines (189 loc) · 8.06 KB
/
cd-matrix.yml
File metadata and controls
218 lines (189 loc) · 8.06 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
name: Continuous Deployment Matrix
permissions:
contents: write
on:
push:
branches:
- master
- vnext
workflow_dispatch:
inputs:
branch:
description: 'Input a branch name (e.g., vnext)'
required: true
env:
REPLACEMENT_TEXT: '@infragistics/igniteui-angular-extras'
BRANCH_REF: ${{ github.event.inputs.branch && format('refs/heads/{0}', github.event.inputs.branch) || github.ref }}
jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: app
custom_command: run generate-live-editing
submodule_dir: angular-demos
base_href: angular-demos
target_folder: dist/app
npm_build_command: run build-ci
repositoryfy: true
repositoryfy_command: repositoryfyAngularDemos
- name: app-crm
custom_command: run generate-live-editing:app-crm
submodule_dir: angular-demos-crm
base_href: angular-demos-grid-crm
target_folder: dist/app-crm
npm_build_command: run build-ci:app-crm --loglevel verbose
repositoryfy: false
repositoryfy_command: ''
- name: app-lob
custom_command: run generate-live-editing:app-lob
submodule_dir: angular-demos-lob
base_href: angular-demos-lob
target_folder: dist/app-lob
npm_build_command: run build-ci:app-lob
repositoryfy: true
repositoryfy_command: repositoryfyAngularDemosLob
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ env.BRANCH_REF }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Replace with licensed angular-extras
shell: pwsh
run: |
# List of files to update
$files = @(
"projects/app-lob/src/app/grid-dynamic-chart-data/grid-dynamic-chart-data.component.ts",
"projects/app-lob/src/app/grid-dynamic-chart-data/data-analysis-dock-manager/data-analysis-dock-manager.component.ts",
"package.json")
foreach ($file in $files) {
if (Test-Path $file) {
(Get-Content -Path $file) -replace 'igniteui-angular-extras', '${{ env.REPLACEMENT_TEXT }}' | Set-Content -Path $file
}
}
- name: Create .npmrc file
run: |
if [ -f ".npmrc" ]; then
rm .npmrc
fi
touch .npmrc
- name: Configure npm registry
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
# echo "//packages.infragistics.com/npm/js-licensed/:_authToken=${{ secrets.INFRAGISTICS_NPM_TOKEN }}" >> .npmrc
- name: Install dependencies
run: npm install
- name: Clone submodule
run: git clone --recurse-submodules https://github.com/IgniteUI/igniteui-live-editing-samples igniteui-live-editing-samples
- name: Checkout branch in submodule (vNext)
if: ${{ env.BRANCH_REF == 'refs/heads/vnext' }}
run: |
cd igniteui-live-editing-samples
git checkout vNext
- name: Checkout branch in submodule (master)
if: ${{ env.BRANCH_REF == 'refs/heads/master' }}
run: |
cd igniteui-live-editing-samples
git checkout master
- name: Update package.json with base href
run: |
sed -i 's|--configuration production|--base-href=/${{ matrix.base_href }}/ --configuration production|g' package.json
- name: Generate live-editing
run: npm ${{ matrix.custom_command }}
- name: Update packages trial->licensed using angular schematics
run: |
npx --userconfig=./.npmrc ng g @igniteui/angular-schematics:upgrade-packages --skip-install
- name: Install dependencies after schematics
run: npm install
- name: Build application
run: npm ${{ matrix.npm_build_command }} --userconfig=./.npmrc
- name: Copy web.config
run: |
if [ -f "projects/app-crm/web.config" ]; then
cp projects/app-crm/web.config ${{ matrix.target_folder }}/browser/
fi
- name: Update web.config file
run: |
if [ -f "${{ matrix.target_folder }}/browser/web.config" ]; then
sed -i 's/angular-demos/${{ matrix.submodule_dir }}/g' ${{ matrix.target_folder }}/browser/web.config
fi
- name: Rename index.csr.html to index.html
run: |
if [ -f "${{ matrix.target_folder }}/browser/index.csr.html" ]; then
mv "${{ matrix.target_folder }}/browser/index.csr.html" "${{ matrix.target_folder }}/browser/index.html"
echo "File renamed successfully."
fi
- name: Create zip artifact
run: |
cd ${{ matrix.target_folder }}/browser
zip -r ${{ github.workspace }}/${{ matrix.base_href }}-artifact.zip ./
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.base_href }}-artifact
path: ${{ matrix.base_href }}-artifact.zip
retention-days: 1
- name: Repositorify (vNext)
if: ${{ env.BRANCH_REF == 'refs/heads/vnext' && matrix.repositoryfy == true }}
run: npm run ${{ matrix.repositoryfy_command }}
- name: Repositorify (Production)
if: ${{ env.BRANCH_REF == 'refs/heads/master' && matrix.repositoryfy == true }}
run: npm run ${{ matrix.repositoryfy_command }}:prod
- name: Check for changes
if: matrix.repositoryfy == true
id: check_changes
run: |
cd igniteui-live-editing-samples/${{ matrix.submodule_dir }}
if [ -n "$(git status --porcelain .)" ]; then
echo "changes_detected=true" >> $GITHUB_OUTPUT
echo "Changed files:"
git status --porcelain .
else
echo "changes_detected=false" >> $GITHUB_OUTPUT
echo "No changes to commit."
fi
- name: Configure git and commit changes
if: matrix.repositoryfy == true && steps.check_changes.outputs.changes_detected == 'true'
run: |
cd igniteui-live-editing-samples/${{ matrix.submodule_dir }}
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Automated repository update"
continue-on-error: true
- name: Push changes
if: matrix.repositoryfy == true && steps.check_changes.outputs.changes_detected == 'true'
run: |
cd igniteui-live-editing-samples/${{ matrix.submodule_dir }}
git push https://x-access-token:${{ secrets.CLASSIC_PAT_GITHUB }}@github.com/IgniteUI/igniteui-live-editing-samples.git
continue-on-error: true
- 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: "${{ matrix.submodule_dir }}-artifact",
base_href: "${{ matrix.base_href }}",
submodule_dir: "${{ matrix.submodule_dir }}",
ref: "${{ github.ref }}",
sha: "${{ github.sha }}",
branch: '${{ github.ref_name }}',
}
});