|
| 1 | +name: IgniteUI React Examples CD |
| 2 | +permissions: |
| 3 | + contents: write |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - vnext |
| 9 | + - master |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + branch: |
| 13 | + description: 'Input a branch name (e.g., vnext)' |
| 14 | + required: true |
| 15 | + isVerbose: |
| 16 | + description: 'Get verbose output from steps - where configurable' |
| 17 | + type: boolean |
| 18 | + default: false |
| 19 | + |
| 20 | +env: |
| 21 | + BRANCH_REF: ${{ github.event.inputs.branch && format('refs/heads/{0}', github.event.inputs.branch) || github.ref }} |
| 22 | + |
| 23 | +jobs: |
| 24 | + BuildSamples: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout repository |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + ref: ${{ env.BRANCH_REF }} |
| 32 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + |
| 34 | + - name: Install Node |
| 35 | + uses: actions/setup-node@v4 |
| 36 | + with: |
| 37 | + node-version: '22.x' |
| 38 | + cache: 'npm' |
| 39 | + cache-dependency-path: browser/package-lock.json |
| 40 | + |
| 41 | + - name: Create .npmrc file |
| 42 | + working-directory: browser |
| 43 | + run: | |
| 44 | + if [ -f ".npmrc" ]; then |
| 45 | + rm .npmrc |
| 46 | + fi |
| 47 | + touch .npmrc |
| 48 | +
|
| 49 | + - name: Configure npm registry |
| 50 | + working-directory: browser |
| 51 | + run: | |
| 52 | + echo "@infragistics:registry=https://packages.infragistics.com/npm/js-licensed/" >> .npmrc |
| 53 | + echo "//packages.infragistics.com/npm/js-licensed/:username=${{ secrets.INFRAGISTICS_NPM_USER }}" >> .npmrc |
| 54 | + echo "//packages.infragistics.com/npm/js-licensed/:_auth=${{ secrets.INFRAGISTICS_NPM_TOKEN }}" >> .npmrc |
| 55 | +
|
| 56 | + - name: Replace references to IG trial packages with licensed ones in package.json |
| 57 | + working-directory: browser |
| 58 | + shell: pwsh |
| 59 | + run: | |
| 60 | + $packageJson = Get-Content -Raw ./package.json | ConvertFrom-Json |
| 61 | + $properties = $packageJson.dependencies.PSObject.Properties ` |
| 62 | + | where-object { $_.Name.StartsWith("igniteui-react") -or $_.Name.StartsWith("igniteui-dockmanager") } |
| 63 | +
|
| 64 | + foreach( $property in $properties ) |
| 65 | + { |
| 66 | + $oldName = $property.Name; |
| 67 | + $newName = "@infragistics/" + $oldName |
| 68 | +
|
| 69 | + # remember the current value of the old property |
| 70 | + $value = $property.Value; |
| 71 | +
|
| 72 | + # remove reference to the trial package reference |
| 73 | + $packageJson.dependencies.psobject.Properties.Remove($oldName); |
| 74 | +
|
| 75 | + # add reference to the licensed package reference |
| 76 | + $packageJson.dependencies | Add-Member -NotePropertyName $newName -NotePropertyValue $value; |
| 77 | + } |
| 78 | +
|
| 79 | + ConvertTo-Json -InputObject $packageJson | Set-Content -Path ./package.json |
| 80 | +
|
| 81 | + - name: npm install |
| 82 | + working-directory: browser |
| 83 | + run: npm install |
| 84 | + |
| 85 | + - name: Replace references to IG trial packages with licensed ones in TSX files |
| 86 | + shell: pwsh |
| 87 | + run: | |
| 88 | + Get-ChildItem -Include "*.tsx","*.ts" -Recurse | ` |
| 89 | + ForEach { (Get-Content $_.PSPath | ForEach { ($_ -replace '(from|import)\s?[''"](igniteui-(react|dockmanager).*)[''"]', '$1 "@infragistics/$2"') }) | ` |
| 90 | + Set-Content $_.PSPath } |
| 91 | +
|
| 92 | + - name: npm run build |
| 93 | + working-directory: browser |
| 94 | + run: npm run build |
| 95 | + |
| 96 | + - name: Package samples browser |
| 97 | + run: | |
| 98 | + cd browser/build |
| 99 | + zip -r ${{ github.workspace }}/react-demos.zip ./ |
| 100 | +
|
| 101 | + - name: Publish pipeline artifact |
| 102 | + uses: actions/upload-artifact@v4 |
| 103 | + with: |
| 104 | + name: react-demos-artifact |
| 105 | + path: react-demos.zip |
| 106 | + |
| 107 | + - name: Trigger Deploy Workflow in IgniteUI Actions |
| 108 | + uses: actions/github-script@v8 |
| 109 | + with: |
| 110 | + github-token: ${{ secrets.CLASSIC_PAT_GITHUB }} |
| 111 | + script: | |
| 112 | + await github.rest.repos.createDispatchEvent({ |
| 113 | + owner: 'IgniteUI', |
| 114 | + repo: 'igniteui-actions', |
| 115 | + event_type: 'igniteui-samples-cd', |
| 116 | + client_payload: { |
| 117 | + calling_branch: "${{ env.BRANCH_REF }}", |
| 118 | + repository: "${{ github.repository }}", |
| 119 | + run_id: "${{ github.run_id }}", |
| 120 | + artifact_name: "react-demos-artifact", |
| 121 | + base_href: "react-demos", |
| 122 | + submodule_dir: "react-demos", |
| 123 | + ref: "${{ github.ref }}", |
| 124 | + sha: "${{ github.sha }}", |
| 125 | + branch: '${{ github.ref_name }}', |
| 126 | + } |
| 127 | + }); |
| 128 | +
|
0 commit comments