Skip to content

Commit 1a34b23

Browse files
committed
refactor(ci): moving cd logic to private pipe
1 parent 5def8ec commit 1a34b23

1 file changed

Lines changed: 9 additions & 148 deletions

File tree

.github/workflows/cd-matrix.yml

Lines changed: 9 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -50,156 +50,10 @@ jobs:
5050
repositoryfy_command: repositoryfyAngularDemosLob
5151

5252
steps:
53-
- name: Checkout repository
54-
uses: actions/checkout@v4
55-
with:
56-
fetch-depth: 0
57-
token: ${{ secrets.GITHUB_TOKEN }}
58-
59-
- name: Setup Node.js
60-
uses: actions/setup-node@v4
61-
with:
62-
node-version: '22.x'
63-
64-
- name: Replace with licensed angular-extras
65-
shell: pwsh
66-
run: |
67-
# List of files to update
68-
$files = @(
69-
"projects/app-lob/src/app/grid-dynamic-chart-data/grid-dynamic-chart-data.component.ts",
70-
"projects/app-lob/src/app/grid-dynamic-chart-data/data-analysis-dock-manager/data-analysis-dock-manager.component.ts",
71-
"package.json")
72-
foreach ($file in $files) {
73-
if (Test-Path $file) {
74-
(Get-Content -Path $file) -replace 'igniteui-angular-extras', '${{ env.REPLACEMENT_TEXT }}' | Set-Content -Path $file
75-
}
76-
}
77-
78-
- name: Create .npmrc file
79-
run: |
80-
if [ -f ".npmrc" ]; then
81-
rm .npmrc
82-
fi
83-
touch .npmrc
84-
85-
86-
- name: Configure npm registry
87-
run: |
88-
echo "@infragistics:registry=https://packages.infragistics.com/npm/js-licensed/" >> .npmrc
89-
echo "//packages.infragistics.com/npm/js-licensed/:username=${{ secrets.INFRAGISTICS_NPM_USER }}" >> .npmrc
90-
echo "//packages.infragistics.com/npm/js-licensed/:_auth=${{ secrets.INFRAGISTICS_NPM_TOKEN }}" >> .npmrc
91-
# echo "//packages.infragistics.com/npm/js-licensed/:_authToken=${{ secrets.INFRAGISTICS_NPM_TOKEN }}" >> .npmrc
92-
93-
- name: Install dependencies
94-
run: npm install
95-
96-
- name: Clone submodule
97-
run: git clone --recurse-submodules https://github.com/IgniteUI/igniteui-live-editing-samples igniteui-live-editing-samples
98-
99-
- name: Checkout branch in submodule (vNext)
100-
if: env.BRANCH_REF == 'refs/heads/vnext'
101-
run: |
102-
cd igniteui-live-editing-samples
103-
git checkout vNext
104-
105-
- name: Checkout branch in submodule (master)
106-
if: env.BRANCH_REF == 'refs/heads/master'
107-
run: |
108-
cd igniteui-live-editing-samples
109-
git checkout master
110-
111-
- name: Update package.json with base href
112-
run: |
113-
sed -i 's|--configuration production|--base-href=${{ matrix.base_href }} --configuration production|g' package.json
114-
115-
- name: Generate live-editing
116-
run: npm ${{ matrix.custom_command }}
117-
118-
- name: Update packages trial->licensed using angular schematics
119-
run: |
120-
npx --userconfig=./.npmrc ng g @igniteui/angular-schematics:upgrade-packages --skip-install
121-
122-
- name: Install dependencies after schematics
123-
run: npm install
124-
125-
- name: Build application
126-
run: npm ${{ matrix.npm_build_command }} --userconfig=./.npmrc
127-
128-
- name: Copy web.config
129-
run: |
130-
if [ -f "projects/app-crm/web.config" ]; then
131-
cp projects/app-crm/web.config ${{ matrix.target_folder }}/browser/
132-
fi
133-
134-
- name: Update web.config file
135-
run: |
136-
if [ -f "${{ matrix.target_folder }}/browser/web.config" ]; then
137-
sed -i 's/angular-demos/${{ matrix.submodule_dir }}/g' ${{ matrix.target_folder }}/browser/web.config
138-
fi
139-
140-
- name: Rename index.csr.html to index.html
141-
run: |
142-
if [ -f "${{ matrix.target_folder }}/browser/index.csr.html" ]; then
143-
mv "${{ matrix.target_folder }}/browser/index.csr.html" "${{ matrix.target_folder }}/browser/index.html"
144-
echo "File renamed successfully."
145-
fi
146-
147-
- name: Create zip artifact
148-
run: |
149-
cd ${{ matrix.target_folder }}/browser
150-
zip -r ../../${{ matrix.submodule_dir }}-artifact.zip ./
151-
152-
- name: Upload artifact
153-
uses: actions/upload-artifact@v4
154-
with:
155-
name: ${{ matrix.submodule_dir }}-artifact
156-
path: ${{ matrix.submodule_dir }}-artifact.zip
157-
158-
- name: Repositorify (vNext)
159-
if: env.BRANCH_REF == 'refs/heads/vnext' && matrix.repositoryfy == true
160-
run: npm run ${{ matrix.repositoryfy_command }}
161-
162-
- name: Repositorify (Production)
163-
if: env.BRANCH_REF == 'refs/heads/master' && matrix.repositoryfy == true
164-
run: npm run ${{ matrix.repositoryfy_command }}:prod
165-
166-
- name: Stage changes
167-
if: matrix.repositoryfy == true
168-
run: |
169-
cd igniteui-live-editing-samples/${{ matrix.submodule_dir }}
170-
git add .
171-
172-
- name: Check for changes
173-
if: matrix.repositoryfy == true
174-
id: check_changes
175-
run: |
176-
cd igniteui-live-editing-samples/${{ matrix.submodule_dir }}
177-
if [ -n "$(git status --porcelain)" ]; then
178-
echo "changes_detected=true" >> $GITHUB_OUTPUT
179-
else
180-
echo "changes_detected=false" >> $GITHUB_OUTPUT
181-
echo "No changes to commit."
182-
fi
183-
184-
- name: Configure git and commit changes
185-
if: matrix.repositoryfy == true && steps.check_changes.outputs.changes_detected == 'true'
186-
run: |
187-
cd igniteui-live-editing-samples/${{ matrix.submodule_dir }}
188-
git config --global user.name "github-actions[bot]"
189-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
190-
git commit -m "Automated repository update"
191-
192-
- name: Push changes
193-
if: matrix.repositoryfy == true && steps.check_changes.outputs.changes_detected == 'true'
194-
run: |
195-
cd igniteui-live-editing-samples/${{ matrix.submodule_dir }}
196-
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/IgniteUI/igniteui-live-editing-samples.git
197-
continue-on-error: true
198-
19953
- name: Trigger Deploy Workflow in IgniteUI Actions
20054
uses: actions/github-script@v8
20155
with:
202-
github-token: ${{ secrets.CLASSIC_PATKA }}
56+
github-token: ${{ secrets.CLASSIC_PAT_GITHUB }}
20357
script: |
20458
await github.rest.repos.createDispatchEvent({
20559
owner: 'IgniteUI',
@@ -208,7 +62,14 @@ jobs:
20862
client_payload: {
20963
repository: "${{ github.repository }}",
21064
run_id: "${{ github.run_id }}",
211-
artifact_name: "${{ matrix.submodule_dir }}-artifact",
65+
calling_branch: "${{ env.BRANCH_REF }}",
66+
custom_command: "${{ matrix.custom_command }}",
67+
submodule_dir: "${{ matrix.submodule_dir }}",
68+
base_href: "${{ matrix.base_href }}",
69+
target_folder: "${{ matrix.target_folder }}",
70+
npm_build_command: "${{ matrix.npm_build_command }}",
71+
repositoryfy: ${{ matrix.repositoryfy }},
72+
repositoryfy_command: "${{ matrix.repositoryfy_command }}",
21273
ref: "${{ github.ref }}",
21374
sha: "${{ github.sha }}",
21475
branch: '${{ github.ref_name }}',

0 commit comments

Comments
 (0)