1- # Starter pipeline
2- # Start with a minimal pipeline that you can customize to build and deploy your code.
3- # Add steps that build, run tests, deploy, and more:
4- # https://aka.ms/yaml
5-
61trigger :
72- ' *'
8-
93pool :
104 vmImage : ' windows-2022'
11-
125variables :
136 solution : ' **/*.sln'
147 buildPlatform : ' Any CPU'
158 buildConfiguration : ' Release'
169
17- steps :
18- - task : PowerShell@2
19- displayName : Create BuildInfo.json
20- inputs :
21- filePath : ' build\create-build-info.ps1'
22- pwsh : true
23- - task : NuGetToolInstaller@1
24- inputs :
25- versionSpec : ' 4.7.1'
26- - task : NuGetCommand@2
27- inputs :
28- command : ' restore'
29- restoreSolution : ' **/*.sln'
30- - task : VSBuild@1
31- inputs :
32- solution : ' **\*.sln'
33- maximumCpuCount : true
34- platform : ' $(buildPlatform)'
35- configuration : ' $(buildConfiguration)'
36- - task : CopyFiles@2
37- inputs :
38- SourceFolder : ' $(Build.SourcesDirectory)'
39- Contents : |
40- README.md
41- build/**
42- **/*.vsix
43- TargetFolder : ' $(Build.ArtifactStagingDirectory)'
44- - task : PublishPipelineArtifact@0
45- inputs :
46- artifactName : ' drop'
47- targetPath : ' $(Build.ArtifactStagingDirectory)'
10+
11+ jobs :
12+ - job : Build_SqlQueryTools
13+ displayName : ' Build latest SqlQueryTools commit'
14+ steps :
15+
16+ - task : NuGetToolInstaller@1
17+ displayName : ' Install nuget tool 4.7.1'
18+ inputs :
19+ versionSpec : ' 4.7.1'
20+
21+ - task : NuGetCommand@2
22+ displayName : ' Restore nuget packages for SqlQueryTools solution'
23+ inputs :
24+ command : ' restore'
25+ restoreSolution : ' **/SqlQueryTools.sln'
26+
27+ - task : VSBuild@1
28+ displayName : ' Build SqlQueryTools solution'
29+ inputs :
30+ solution : ' **\SqlQueryTools.sln'
31+ maximumCpuCount : true
32+ platform : ' $(buildPlatform)'
33+ configuration : ' $(buildConfiguration)'
34+
35+ - task : CopyFiles@2
36+ displayName : ' Copy result of build to Artifact folder'
37+ inputs :
38+ SourceFolder : ' $(Build.SourcesDirectory)'
39+ Contents : |
40+ README.md
41+ **/SqlQueryTools.vsix
42+ TargetFolder : ' $(Build.StagingDirectory)/Artifact'
43+
44+ - task : PublishPipelineArtifact@1
45+ displayName : ' Publish Artifact folder'
46+ inputs :
47+ targetPath : ' $(Build.StagingDirectory)/Artifact'
48+ artifact : ' SqlQueryTools'
49+ publishLocation : ' pipeline'
50+
51+ - task : PowerShell@2
52+ name : CurrentVsixManifest
53+ displayName : ' Read current vsix version from manifest file'
54+ inputs :
55+ targetType : ' inline'
56+ script : |
57+ $vsixManifestPath = Resolve-Path $(Build.SourcesDirectory)\src\SqlQueryTools\source.extension.vsixmanifest
58+ [xml]$vsixManifestContent = Get-Content $vsixManifestPath
59+ $vsixVersion = $vsixManifestContent.PackageManifest.Metadata.Identity.Version
60+ echo "Found vsix version = $vsixVersion"
61+ echo "##vso[task.setvariable variable=VsixVersion;isOutput=true]$vsixVersion"
62+
63+ - task : DownloadGitHubRelease@0
64+ displayName : ' Download the latest release from GitHub'
65+ inputs :
66+ connection : ' github release connection'
67+ userRepository : ' gmarginet/SqlQueryTools'
68+ defaultVersionType : ' latest'
69+ itemPattern : ' **/*.vsix'
70+ downloadPath : ' $(Build.StagingDirectory)/PreviousGitHubRelease'
71+
72+ - task : ExtractFiles@1
73+ displayName : ' Extract the latest release'
74+ inputs :
75+ archiveFilePatterns : ' $(System.ArtifactsDirectory)/PreviousGitHubRelease/*.vsix'
76+ destinationFolder : ' $(System.ArtifactsDirectory)/PreviousGitHubRelease/Content'
77+ cleanDestinationFolder : true
78+ overwriteExistingFiles : false
79+
80+ - task : PowerShell@2
81+ name : PreviousVsixManifest
82+ displayName : ' Read previous vsix version from manifest file'
83+ inputs :
84+ targetType : ' inline'
85+ script : |
86+ $vsixManifestPath = Resolve-Path $(System.ArtifactsDirectory)\PreviousGitHubRelease\Content\extension.vsixmanifest
87+ [xml]$vsixManifestContent = Get-Content $vsixManifestPath
88+ $vsixVersion = $vsixManifestContent.PackageManifest.Metadata.Identity.Version
89+ echo "Found vsix version = $vsixVersion"
90+ echo "##vso[task.setvariable variable=VsixVersion;isOutput=true]$vsixVersion"
91+
92+
93+
94+ - job : Deploy_SqlQueryTools
95+ displayName : ' Deploy latest SqlQueryTools commit'
96+ dependsOn :
97+ - Build_SqlQueryTools
98+ condition : and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(dependencies.Build_SqlQueryTools.outputs['CurrentVsixManifest.VsixVersion'], dependencies.Build_SqlQueryTools.outputs['PreviousVsixManifest.VsixVersion']))
99+ steps :
100+
101+ - checkout : none
102+
103+ - task : DownloadPipelineArtifact@2
104+ inputs :
105+ buildType : ' current'
106+ artifactName : ' SqlQueryTools'
107+ targetPath : ' $(Build.StagingDirectory)/Artifact'
108+
109+ - task : PowerShell@2
110+ displayName : ' tmp'
111+ inputs :
112+ targetType : ' inline'
113+ script : |
114+ echo "Start Deploy"
115+ $vsixPath = Resolve-Path $(Build.StagingDirectory)\Artifact\
116+ Get-ChildItem
0 commit comments