|
| 1 | +name: Continuous Deployment Matrix |
| 2 | +permissions: |
| 3 | + contents: write |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + - vnext |
| 10 | + workflow_dispatch: |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + branch: |
| 14 | + description: 'Input a branch name (e.g., vnext)' |
| 15 | + required: true |
| 16 | + |
| 17 | +env: |
| 18 | + REPLACEMENT_TEXT: '@infragistics/igniteui-angular-extras' |
| 19 | + BRANCH_REF: ${{ github.event.inputs.branch && format('refs/heads/{0}', github.event.inputs.branch) || github.ref }} |
| 20 | + |
| 21 | +jobs: |
| 22 | + build-and-deploy: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - name: app |
| 28 | + custom_command: run generate-live-editing |
| 29 | + submodule_dir: angular-demos |
| 30 | + base_href: /angular-demos/ |
| 31 | + target_folder: dist/app |
| 32 | + npm_build_command: run build-ci |
| 33 | + repositoryfy: true |
| 34 | + repositoryfy_command: repositoryfyAngularDemos |
| 35 | + - name: app-crm |
| 36 | + custom_command: run generate-live-editing:app-crm |
| 37 | + submodule_dir: angular-demos-crm |
| 38 | + base_href: /angular-demos-grid-crm/ |
| 39 | + target_folder: dist/app-crm |
| 40 | + npm_build_command: run build-ci:app-crm --loglevel verbose |
| 41 | + repositoryfy: false |
| 42 | + repositoryfy_command: '' |
| 43 | + - name: app-lob |
| 44 | + custom_command: run generate-live-editing:app-lob |
| 45 | + submodule_dir: angular-demos-lob |
| 46 | + base_href: /angular-demos-lob/ |
| 47 | + target_folder: dist/app-lob |
| 48 | + npm_build_command: run build-ci:app-lob |
| 49 | + repositoryfy: true |
| 50 | + repositoryfy_command: repositoryfyAngularDemosLob |
| 51 | + |
| 52 | + 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: touch .npmrc |
| 80 | + |
| 81 | + - name: Configure npm registry |
| 82 | + run: | |
| 83 | + echo "@infragistics:registry=https://packages.infragistics.com/npm/js-licensed/" >> .npmrc |
| 84 | + echo "//packages.infragistics.com/npm/js-licensed/:_authToken=${{ secrets.INFRAGISTICS_NPM_TOKEN }}" >> .npmrc |
| 85 | +
|
| 86 | + - name: Install dependencies |
| 87 | + run: npm install |
| 88 | + env: |
| 89 | + GITHUB_ACTIONS: true |
| 90 | + |
| 91 | + - name: Clone submodule |
| 92 | + run: git clone --recurse-submodules https://github.com/IgniteUI/igniteui-live-editing-samples igniteui-live-editing-samples |
| 93 | + |
| 94 | + - name: Checkout branch in submodule (vNext) |
| 95 | + if: env.BRANCH_REF == 'refs/heads/vnext' |
| 96 | + run: | |
| 97 | + cd igniteui-live-editing-samples |
| 98 | + git checkout vNext |
| 99 | +
|
| 100 | + - name: Checkout branch in submodule (master) |
| 101 | + if: env.BRANCH_REF == 'refs/heads/master' |
| 102 | + run: | |
| 103 | + cd igniteui-live-editing-samples |
| 104 | + git checkout master |
| 105 | +
|
| 106 | + - name: Update package.json with base href |
| 107 | + run: | |
| 108 | + sed -i 's/--configuration production/--base-href=${{ matrix.base_href }} --configuration production/g' package.json |
| 109 | +
|
| 110 | + - name: Generate live-editing |
| 111 | + run: npm ${{ matrix.custom_command }} |
| 112 | + |
| 113 | + - name: Update packages trial->licensed using angular schematics |
| 114 | + run: | |
| 115 | + npx --userconfig=./.npmrc ng g @igniteui/angular-schematics:upgrade-packages --skip-install |
| 116 | +
|
| 117 | + - name: Install dependencies after schematics |
| 118 | + run: npm install |
| 119 | + env: |
| 120 | + GITHUB_ACTIONS: true |
| 121 | + |
| 122 | + - name: Build application |
| 123 | + run: npm ${{ matrix.npm_build_command }} --userconfig=./.npmrc |
| 124 | + |
| 125 | + - name: Copy web.config |
| 126 | + run: | |
| 127 | + if [ -f "projects/app-crm/web.config" ]; then |
| 128 | + cp projects/app-crm/web.config ${{ matrix.target_folder }}/browser/ |
| 129 | + fi |
| 130 | +
|
| 131 | + - name: Update web.config file |
| 132 | + run: | |
| 133 | + if [ -f "${{ matrix.target_folder }}/browser/web.config" ]; then |
| 134 | + sed -i 's/angular-demos/${{ matrix.submodule_dir }}/g' ${{ matrix.target_folder }}/browser/web.config |
| 135 | + fi |
| 136 | +
|
| 137 | + - name: Rename index.csr.html to index.html |
| 138 | + run: | |
| 139 | + if [ -f "${{ matrix.target_folder }}/browser/index.csr.html" ]; then |
| 140 | + mv "${{ matrix.target_folder }}/browser/index.csr.html" "${{ matrix.target_folder }}/browser/index.html" |
| 141 | + echo "File renamed successfully." |
| 142 | + fi |
| 143 | +
|
| 144 | + - name: Create zip artifact |
| 145 | + run: | |
| 146 | + cd ${{ matrix.target_folder }}/browser |
| 147 | + zip -r ../../${{ matrix.submodule_dir }}-artifact.zip ./ |
| 148 | +
|
| 149 | + - name: Upload artifact |
| 150 | + uses: actions/upload-artifact@v4 |
| 151 | + with: |
| 152 | + name: ${{ matrix.submodule_dir }}-artifact |
| 153 | + path: ${{ matrix.submodule_dir }}-artifact.zip |
| 154 | + |
| 155 | + - name: Repositorify (vNext) |
| 156 | + if: env.BRANCH_REF == 'refs/heads/vnext' && matrix.repositoryfy == true |
| 157 | + run: npm run ${{ matrix.repositoryfy_command }} |
| 158 | + |
| 159 | + - name: Repositorify (Production) |
| 160 | + if: env.BRANCH_REF == 'refs/heads/master' && matrix.repositoryfy == true |
| 161 | + run: npm run ${{ matrix.repositoryfy_command }}:prod |
| 162 | + |
| 163 | + - name: Stage changes |
| 164 | + if: matrix.repositoryfy == true |
| 165 | + run: | |
| 166 | + cd igniteui-live-editing-samples/${{ matrix.submodule_dir }} |
| 167 | + git add . |
| 168 | +
|
| 169 | + - name: Check for changes |
| 170 | + if: matrix.repositoryfy == true |
| 171 | + id: check_changes |
| 172 | + run: | |
| 173 | + cd igniteui-live-editing-samples/${{ matrix.submodule_dir }} |
| 174 | + if [ -n "$(git status --porcelain)" ]; then |
| 175 | + echo "changes_detected=true" >> $GITHUB_OUTPUT |
| 176 | + else |
| 177 | + echo "changes_detected=false" >> $GITHUB_OUTPUT |
| 178 | + echo "No changes to commit." |
| 179 | + fi |
| 180 | +
|
| 181 | + - name: Configure git and commit changes |
| 182 | + if: matrix.repositoryfy == true && steps.check_changes.outputs.changes_detected == 'true' |
| 183 | + run: | |
| 184 | + cd igniteui-live-editing-samples/${{ matrix.submodule_dir }} |
| 185 | + git config --global user.name "github-actions[bot]" |
| 186 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 187 | + git commit -m "Automated repository update" |
| 188 | +
|
| 189 | + - name: Push changes |
| 190 | + if: matrix.repositoryfy == true && steps.check_changes.outputs.changes_detected == 'true' |
| 191 | + run: | |
| 192 | + cd igniteui-live-editing-samples/${{ matrix.submodule_dir }} |
| 193 | + git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/IgniteUI/igniteui-live-editing-samples.git |
| 194 | + continue-on-error: true |
| 195 | + |
| 196 | + - name: Trigger Deploy Workflow in IgniteUI Actions |
| 197 | + uses: actions/github-script@v8 |
| 198 | + with: |
| 199 | + github-token: ${{ secrets.CLASSIC_PATKA }} |
| 200 | + script: | |
| 201 | + await github.rest.repos.createDispatchEvent({ |
| 202 | + owner: 'IgniteUI', |
| 203 | + repo: 'igniteui-actions', |
| 204 | + event_type: 'igniteui-angular-samples-cd', |
| 205 | + client_payload: { |
| 206 | + repository: "${{ github.repository }}", |
| 207 | + run_id: "${{ github.run_id }}", |
| 208 | + artifact_name: "${{ matrix.submodule_dir }}-artifact", |
| 209 | + ref: "${{ github.ref }}", |
| 210 | + sha: "${{ github.sha }}", |
| 211 | + branch: '${{ github.ref_name }}', |
| 212 | + unit: false, |
| 213 | + integration: true |
| 214 | + } |
| 215 | + }); |
0 commit comments