-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
66 lines (56 loc) · 2.09 KB
/
azure-pipelines.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
name: $(BuildDefinitionName)-$(Date:yyyyMMdd).$(Rev:.r)
trigger:
- master
pool:
vmImage: 'vs2017-win2016'
steps:
- script: md tools
displayName: 'Create tools directory'
- powershell: |
Invoke-WebRequest `
-Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe `
-OutFile tools\\nuget.exe
displayName: 'Download nuget.exe'
- powershell: |
tools\\nuget.exe install Microsoft.CrmSdk.CoreTools -O tools
md "tools\\CoreTools"
$coreToolsFolder = Get-ChildItem tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.CoreTools.'}
move "tools\\$coreToolsFolder\\content\\bin\\coretools\\*.*" "tools\\CoreTools"
Remove-Item "tools\\$coreToolsFolder" -Force -Recurse
displayName: 'Install CoreTools'
- powershell: |
Start-Process tools/CoreTools/SolutionPackager.exe `
-ArgumentList `
"/action: Pack", `
"/zipfile: $(Build.ArtifactStagingDirectory)\packedSolution\$env:SolutionName.zip", `
"/folder: $env:SolutionPath", `
"/packagetype: Both" `
-Wait `
-NoNewWindow
env:
SolutionPath: $(solution.path)
SolutionName: $(solution.name)
displayName: 'Solution Packager: pack solution'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: drop
displayName: 'Publish build artifacts'
- powershell: Install-Module Microsoft.Xrm.Data.Powershell -Scope CurrentUser -Force
displayName: 'Install Microsoft.Xrm.Data.PowerShell'
- powershell: |
$connection = Get-CrmConnection `
-ConnectionString `
("AuthType = Office365;" + `
"Username = $env:ServiceAccountUpn;" + `
"Password = $env:ServiceAccountPassword;" + `
"Url = https://$env:EnvironmentName.crm.dynamics.com")
Import-CrmSolution `
-conn $connection `
-SolutionFilePath $(Build.ArtifactStagingDirectory)\packedSolution\$($env:SolutionName)_managed.zip
env:
EnvironmentName: $(environment.name)
SolutionName: $(solution.name)
ServiceAccountUpn: $(serviceAccount.upn)
ServiceAccountPassword: $(serviceAccount.password)
displayName: 'Import solution'