-
Notifications
You must be signed in to change notification settings - Fork 78
/
Copy pathShesha-Framework-Starter-Latest-BP.yml
286 lines (282 loc) · 10.5 KB
/
Shesha-Framework-Starter-Latest-BP.yml
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# Variable 'artifactName' was defined in the Variables tab - This is from my fix branch
# Agent Queue 'Azure Pipelines' was used with unrecognized Agent Specification, vmImage property must be specified to determine image - https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#software
variables:
- name: BuildParameters.solution1
value: ShaCompanyName.ShaProjectName.sln
- name: BuildParameters.solution2
value: ShaCompanyName.ShaProjectName.sln
- name: BuildParameters.configuration
value: release
- name: pack-version
value: ""
- name: isMain
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
pr:
branches:
include:
- releases/*
- main
trigger:
tags:
include:
- 'release-*'
branches:
include:
- releases/*
- main
pool:
name: Azure Pipelines
vmImage1: windows-latest
vmImage2: ubuntu-latest
# name: 2.0.0.$(BuildID)
stages:
- stage: build
jobs:
- job: Job_1
displayName: Build_Functional_Shesha_API
pool:
name: Azure Pipelines
vmImage: windows-latest
steps:
- checkout: self
- task: PowerShell@2
displayName: Check if Pull Request
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
$targetBranch = ""
if ("$(Build.SourceBranch)" -like "*/pull/*")
{
$targetBranch = "$(System.PullRequest.TargetBranch)"
write-host "This is a Pull Request and the target branch is: $targetBranch"
write-host "##vso[task.setvariable variable=prTargetBranch]$targetBranch"
}
else
{
write-host "This is not a Pull Request and the target branch is set to empty string"
write-host "##vso[task.setvariable variable=prTargetBranch]''"
}
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: PowerShell@2
displayName: Check to establish if this pipeline was triggered from a tag
inputs:
filePath: 'ReleaseFlow.ps1'
workingDirectory: '$(System.DefaultWorkingDirectory)'
arguments: '-PipeBuildNumber "$(Build.BuildNumber)" -PipeSourceBranch "$(Build.SourceBranch)" -PipeSourceVersion "$(Build.SourceVersion)" -PipeTargetBranch "$(prTargetBranch)" -PipeBuildId "$(Build.BuildId)"'
- task: PowerShell@2
displayName: Output to console the current branch and version
inputs:
targetType: 'inline'
script: |
write-host "The current branch is: $(currentBranch)"
write-host "The current version is: $(versionNo)"
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: PowerShell@2
displayName: Create a txt file to carry the original branch name to the release pipeline
inputs:
targetType: 'inline'
script: |
$variable = '$(currentBranch)'
$variable | Out-File $(Build.ArtifactStagingDirectory)\branchName.txt
Get-Content $(Build.ArtifactStagingDirectory)\branchName.txt
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: api-info-1'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'api-info-1'
- task: UseDotNet@2
displayName: Use .NET Core sdk 8.x
inputs:
version: 8.x
- task: Assembly-Info-NetCore@3
displayName: 'Set Assembly Manifest Data'
inputs:
InsertAttributes: true
VersionNumber: "$(versionNo)"
FileVersionNumber: "$(versionNo)"
InformationalVersion: "$(versionNo)"
PackageVersion: "$(versionNo)"
Description: "$(assemblyDescription)"
# condition: ne(variables['currentBranch'], 'refs/heads/main')
- task: DotNetCoreCLI@2
displayName: dotnet Restore
inputs:
command: 'restore'
projects: shesha-starter/backend/src/*Host/*.csproj
feedsToUse: 'config'
nugetConfigPath: shesha-starter/backend/.nuget/NuGet.Config
# feedsToUse: 'select'
# vstsFeed: '44b4667a-8963-403d-9962-bde66225adbd'
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
projects: shesha-starter/backend/src/*Host/*.csproj
arguments: --configuration $(BuildParameters.configuration)
- task: DotNetCoreCLI@2
displayName: dotnet publish
inputs:
command: publish
publishWebProjects: false
projects: shesha-starter/backend/src/*Host/*.csproj
arguments: --configuration $(BuildParameters.configuration) --output $(build.artifactstagingdirectory) --no-build
zipAfterPublish: false
modifyOutputPath: false
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: starter-shesha-api'
inputs:
ArtifactName: starter-shesha-api
# - task: DotNetCoreCLI@2
# displayName: dotnet pack
# inputs:
# command: 'pack'
# packagesToPack: 'shesha-functional-tests/backend/src/**/*.csproj'
# # packagesToPack: 'shesha-functional-tests/backend/src/Boxfusion.SheshaFunctionalTests.Web.Host.csproj'
# configuration: '$(BuildParameters.configuration)'
# nobuild: false
# includesymbols: true
# includesource: true
# versioningScheme: 'byEnvVar'
# versionEnvVar: 'versionNo'
- task: DotNetCoreCLI@2
displayName: dotnet pack
inputs:
command: 'pack'
packagesToPack: shesha-starter/backend/src/*Host/*.csproj
# packagesToPack: 'shesha-functional-tests/backend/src/Boxfusion.SheshaFunctionalTests.Web.Host.csproj'
configuration: '$(BuildParameters.configuration)'
nobuild: false
includesymbols: true
includesource: true
versioningScheme: 'byEnvVar'
versionEnvVar: 'versionNo'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Nuget packs'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'packs-functional'
- job: Job_2
displayName: Build_Starter
pool:
vmImage: windows-latest
steps:
- task: PowerShell@2
displayName: Check if Pull Request
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
$targetBranch = ""
if ("$(Build.SourceBranch)" -like "*/pull/*")
{
$targetBranch = "$(System.PullRequest.TargetBranch)"
write-host "This is a Pull Request and the target branch is: $targetBranch"
write-host "##vso[task.setvariable variable=prTargetBranch]$targetBranch"
}
else
{
write-host "This is not a Pull Request and the target branch is set to empty string"
write-host "##vso[task.setvariable variable=prTargetBranch]''"
}
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: PowerShell@2
displayName: Check to establish if this pipeline was triggered from a tag
inputs:
filePath: 'ReleaseFlow.ps1'
workingDirectory: '$(System.DefaultWorkingDirectory)'
arguments: '-PipeBuildNumber "$(Build.BuildNumber)" -PipeSourceBranch "$(Build.SourceBranch)" -PipeSourceVersion "$(Build.SourceVersion)" -PipeTargetBranch "$(prTargetBranch)" -PipeBuildId "$(Build.BuildId)"'
- task: PowerShell@2
displayName: Output to console the current branch
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
write-host "The current branch is: $(currentBranch)"
write-host "The current version is: $(versionNo)"
workingDirectory: 'shesha-starter/frontend'
- task: NodeTool@0
displayName: 'Use Node 23.x'
inputs:
versionSpec: 23.x
retryCountOnTaskFailure: 5
- task: Npm@1
displayName: 'Npm Update Version'
inputs:
command: custom
workingDir: shesha-reactjs
verbose: false
customCommand: 'version $(versionNo) --allow-same-version'
# condition: ne(variables['currentBranch'], 'refs/heads/main')
- task: Npm@1
displayName: 'Npm Install'
inputs:
command: custom
workingDir: shesha-reactjs
verbose: false
customCommand: 'install'
# - task: Npm@1
# displayName: Install Latest Shesha
# inputs:
# command: custom
# workingDir: 'shesha-functional-tests/frontend'
# verbose: true
# customCommand: install @shesha/reactjs@latest
- task: Npm@1
displayName: Npm Build
inputs:
command: custom
workingDir: shesha-reactjs
verbose: true
customCommand: run build
- task: Npm@1
displayName: 'Npm Update Version'
inputs:
command: custom
workingDir: shesha-starter/frontend
verbose: false
customCommand: 'version $(versionNo) --allow-same-version'
# condition: ne(variables['currentBranch'], 'refs/heads/main')
- task: Npm@1
displayName: 'Npm Install'
inputs:
command: custom
workingDir: shesha-starter/frontend
verbose: false
customCommand: 'install'
# - task: Npm@1
# displayName: Install Latest Shesha
# inputs:
# command: custom
# workingDir: 'shesha-functional-tests/frontend'
# verbose: true
# customCommand: install @shesha/reactjs@latest
- task: Npm@1
displayName: Npm Build
inputs:
command: custom
workingDir: 'shesha-starter/frontend'
verbose: true
customCommand: run build
# Creating a temporary directory to copy both node apps
- task: PowerShell@2
displayName: 'Preparing ReactJS for Archiving'
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
mkdir temp
Write-Host "Copying Shesha ReactJS Artifacts"
cp -R frontend temp
workingDirectory: '$(System.DefaultWorkingDirectory)/shesha-starter'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/shesha-starter/temp'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/adminportal.zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: shesha-adminportal-starter'
inputs:
ArtifactName: adminportal-starter