|
| 1 | +trigger: |
| 2 | + branches: |
| 3 | + include: |
| 4 | + - vnext |
| 5 | + - master |
| 6 | + |
| 7 | +# This pipeline is meant to build specific branches for deployment. It's not meant to be a part of PR validation. |
| 8 | +pr: none |
| 9 | + |
| 10 | +parameters: |
| 11 | +- name: isVerbose |
| 12 | + displayName: 'Get verbose output from steps - where configurable' |
| 13 | + type: boolean |
| 14 | + default: false |
| 15 | +- name: shouldCleanPostExecution |
| 16 | + displayName: 'Clean all pipeline dirs after the pipeline finishes?' |
| 17 | + type: boolean |
| 18 | + default: true |
| 19 | + |
| 20 | + |
| 21 | +name: $(Year:yyyy).$(Month).$(DayOfMonth)-r$(Rev:.r) |
| 22 | + |
| 23 | +stages: |
| 24 | +- stage: Build |
| 25 | + pool: |
| 26 | + vmImage: ubuntu-latest |
| 27 | + |
| 28 | + demands: npm |
| 29 | + jobs: |
| 30 | + - job: BuildSamples |
| 31 | + steps: |
| 32 | + - checkout: 'self' |
| 33 | + clean: true |
| 34 | + |
| 35 | + - task: NodeTool@0 |
| 36 | + displayName: 'Install Node' |
| 37 | + inputs: |
| 38 | + versionSource: 'spec' |
| 39 | + versionSpec: '18.x' |
| 40 | + |
| 41 | + - task: Bash@3 |
| 42 | + displayName: 'Create download artifact per sample (Shell)' |
| 43 | + inputs: |
| 44 | + targetType: 'inline' |
| 45 | + script: | |
| 46 | + # Define the root path where projects are located |
| 47 | + rootPath="$(Build.SourcesDirectory)/projects" |
| 48 | + |
| 49 | + # Get all first-level subdirectories in the specified root path |
| 50 | + subdirectories=$(find "$rootPath" -mindepth 1 -maxdepth 1 -type d) |
| 51 | + |
| 52 | + for subdirectory in $subdirectories; do |
| 53 | + # Extract the directory name from the path |
| 54 | + dirName=$(basename "$subdirectory") |
| 55 | +
|
| 56 | + # Give each sample a version in its package.json file - for traceability |
| 57 | + cd "$subdirectory" |
| 58 | + echo "Calling npm version command" |
| 59 | + npm version $(Build.BuildNumber) --no-git-tag-version |
| 60 | +
|
| 61 | + # Check if the directory name is already camel-case |
| 62 | + if [[ "$dirName" =~ ^[A-Z]+[a-z]+([A-Z][a-z]*)*$ ]]; then |
| 63 | + # If already camel-case, print it as is |
| 64 | + echo "$dirName" |
| 65 | + else |
| 66 | + # Convert to camel-case (capitalize first letters and remove hyphens) |
| 67 | + dirName=$(echo "$dirName" | sed -E 's/(^|-)([a-z])/\U\2/g') |
| 68 | +
|
| 69 | + fi |
| 70 | + |
| 71 | + echo "Processing directory: $dirName" |
| 72 | + |
| 73 | + # Define the name for the zip file |
| 74 | + zipName="$(Build.ArtifactStagingDirectory)/IgniteUI_WebComponents_ApplicationSample_${dirName}_Source.zip" |
| 75 | + echo "Creating ZIP: $zipName" |
| 76 | + |
| 77 | + # Compress the directory into a ZIP file |
| 78 | + (cd "$subdirectory" && zip -r "$zipName" .) |
| 79 | + done |
| 80 | + |
| 81 | + echo "All sample projects have been compressed and saved to the artifacts directory." |
| 82 | +
|
| 83 | + - task: PublishPipelineArtifact@1 |
| 84 | + displayName: 'Publish Samples Sources zips' |
| 85 | + inputs: |
| 86 | + targetPath: '$(Build.ArtifactStagingDirectory)' |
| 87 | + artifact: 'samplesSourcesZips' |
| 88 | + publishLocation: 'pipeline' |
| 89 | + |
| 90 | + - task: Npm@1 |
| 91 | + displayName: 'Register licensed npm registry in .npmrc' |
| 92 | + inputs: |
| 93 | + verbose: ${{ parameters.isVerbose }} |
| 94 | + command: 'custom' |
| 95 | + workingDir: '$(Build.SourcesDirectory)' |
| 96 | + customCommand: 'config -L project set @infragistics:registry=https://packages.infragistics.com/npm/js-licensed/' |
| 97 | + customEndpoint: 'public proget' |
| 98 | + |
| 99 | + - task: npmAuthenticate@0 |
| 100 | + displayName: '[IG Production ProGet] npm authenticate' |
| 101 | + inputs: |
| 102 | + workingFile: '$(Build.SourcesDirectory)/.npmrc' |
| 103 | + customEndpoint: 'public proget' |
| 104 | + |
| 105 | + - task: Npm@1 |
| 106 | + displayName: 'npm install --legacy-peer-deps' |
| 107 | + inputs: |
| 108 | + verbose: ${{ parameters.isVerbose }} |
| 109 | + command: custom |
| 110 | + workingDir: '$(Build.SourcesDirectory)' |
| 111 | + customCommand: 'install --legacy-peer-deps' |
| 112 | + customEndpoint: 'public proget' |
| 113 | + |
| 114 | + - task: Npm@1 |
| 115 | + displayName: 'Install Ignite UI CLI globally' |
| 116 | + inputs: |
| 117 | + verbose: ${{ parameters.isVerbose }} |
| 118 | + command: custom |
| 119 | + workingDir: '$(Build.SourcesDirectory)' |
| 120 | + customCommand: 'install -g igniteui-cli' |
| 121 | + |
| 122 | + - task: PowerShell@2 |
| 123 | + displayName: 'Update vite.config to licensed' |
| 124 | + inputs: |
| 125 | + failOnStderr: true |
| 126 | + showWarnings: true |
| 127 | + workingDirectory: '$(Build.SourcesDirectory)' |
| 128 | + targetType: 'inline' |
| 129 | + script: | |
| 130 | + #Update vite.config.ts |
| 131 | + $viteConfig = Get-Content -Raw ./vite.config.ts |
| 132 | + $updatedViteConfig = $viteConfig -replace 'igniteui-webcomponents-', '@infragistics/igniteui-webcomponents-' |
| 133 | + $updatedViteConfig | Set-Content ./vite.config.ts |
| 134 | +
|
| 135 | + - task: Bash@3 |
| 136 | + displayName: 'Run Ignite UI Upgrade in Root and All Project Subdirectories' |
| 137 | + inputs: |
| 138 | + targetType: 'inline' |
| 139 | + script: | |
| 140 | + echo "Running Ignite UI package upgrade at root level..." |
| 141 | + npx ig upgrade-packages --skip-install |
| 142 | +
|
| 143 | + echo "Running Ignite UI package upgrade in all project subdirectories..." |
| 144 | + for dir in $(Build.SourcesDirectory)/projects/*/; do |
| 145 | + if [ -d "$dir" ]; then |
| 146 | + echo "Processing: $dir" |
| 147 | + (cd "$dir" && npx ig upgrade-packages --skip-install) |
| 148 | + fi |
| 149 | + done |
| 150 | +
|
| 151 | + - task: Npm@1 |
| 152 | + displayName: 'npm install --legacy-peer-deps' |
| 153 | + inputs: |
| 154 | + verbose: ${{ parameters.isVerbose }} |
| 155 | + command: custom |
| 156 | + workingDir: '$(Build.SourcesDirectory)' |
| 157 | + customCommand: 'install --legacy-peer-deps' |
| 158 | + |
| 159 | + - task: Npm@1 |
| 160 | + displayName: 'npm run build:ci' |
| 161 | + inputs: |
| 162 | + verbose: ${{ parameters.isVerbose }} |
| 163 | + command: custom |
| 164 | + workingDir: '$(Build.SourcesDirectory)' |
| 165 | + customCommand: 'run build:ci' |
| 166 | + |
| 167 | + - task: PublishPipelineArtifact@1 |
| 168 | + displayName: 'Publish app' |
| 169 | + inputs: |
| 170 | + targetPath: '$(Build.SourcesDirectory)/dist' |
| 171 | + artifact: 'dist.grid-demos-wc' |
| 172 | + publishLocation: 'pipeline' |
| 173 | + |
| 174 | + - ${{ if eq(parameters.shouldCleanPostExecution, true) }}: |
| 175 | + - task: PostBuildCleanup@4 |
0 commit comments