1
+ name : TextUtility-ModuleBuild-$(Build.BuildId)
2
+ trigger : none
3
+ pr : none
4
+
5
+ variables :
6
+ BuildConfiguration : Release
7
+ DOTNET_NOLOGO : true
8
+ DOTNET_GENERATE_ASPNET_CERTIFICATE : false
9
+ DOTNET_CLI_TELEMETRY_OPTOUT : 1
10
+ POWERSHELL_TELEMETRY_OPTOUT : 1
11
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE : 1
12
+ WindowsContainerImage : onebranch.azurecr.io/windows/ltsc2022/vse2022:latest
13
+
14
+ resources :
15
+ repositories :
16
+ - repository : templates
17
+ type : git
18
+ name : OneBranch.Pipelines/GovernedTemplates
19
+ ref : refs/heads/main
20
+
21
+ extends :
22
+ # https://aka.ms/obpipelines/templates
23
+ template : v2/OneBranch.Official.CrossPlat.yml@templates
24
+ parameters :
25
+ featureFlags :
26
+ WindowsHostVersion : ' 1ESWindows2022'
27
+ globalSdl : # https://aka.ms/obpipelines/sdl
28
+ asyncSdl :
29
+ enabled : true
30
+ forStages : [build]
31
+ # credscan:
32
+ # enabled: true
33
+ # scanfolder: $(Build.SourcesDirectory)
34
+ # suppressionsFile: $(Build.SourcesDirectory)\.config\suppress.json
35
+ stages :
36
+ - stage : build
37
+ jobs :
38
+ - job : main
39
+ displayName : Build package
40
+ pool :
41
+ type : windows
42
+ variables :
43
+ - name : ob_outputDirectory
44
+ value : $(Build.SourcesDirectory)/out
45
+ # - name: ob_sdl_credscan_suppressionsFile
46
+ # value: $(Build.SourcesDirectory)\.config\suppress.json
47
+ steps :
48
+ - pwsh : |
49
+ Write-Verbose -Verbose ((Get-Item $(Build.SourcesDirectory)).FullName)
50
+ Get-ChildItem $(Build.SourcesDirectory) -Recurse -File -Name | Write-Verbose -Verbose
51
+ $manifestData = Import-PowerShellDataFile -Path src/Microsoft.PowerShell.TextUtility.psd1
52
+ $moduleVersion = $manifestData.ModuleVersion
53
+ Write-Output "##vso[task.setvariable variable=version;isOutput=true]$moduleVersion"
54
+ if ($manifestData.PrivateData.PsData.Prerelease) {
55
+ $prerel = $manifestData.PrivateData.PSData.Prerelease
56
+ $nupkgVersion = "${moduleVersion}-${prerel}"
57
+ } else {
58
+ $nupkgVersion = $moduleVersion
59
+ }
60
+ Write-Output "##vso[task.setvariable variable=nupkgversion;isOutput=true]$nupkgVersion"
61
+ name: package
62
+ displayName: Get version from project properties
63
+ - task : onebranch.pipeline.version@1
64
+ displayName : Set OneBranch version
65
+ inputs :
66
+ system : Custom
67
+ customVersion : $(package.version)
68
+ - task : UseDotNet@2
69
+ displayName : Use .NET SDK
70
+ inputs :
71
+ packageType : sdk
72
+ useGlobalJson : true
73
+ - pwsh : |
74
+ Get-ChildItem | Write-Verbose -Verbose
75
+ ./build.ps1 -Configuration Release
76
+ displayName: Build
77
+ - task : onebranch.pipeline.signing@1
78
+ displayName : Sign 1st-party files
79
+ inputs :
80
+ command : sign
81
+ signing_profile : external_distribution
82
+ search_root : $(Build.SourcesDirectory)/out/Microsoft.PowerShell.TextUtility
83
+ files_to_sign : |
84
+ *.psd1;
85
+ *.ps1xml;
86
+ Microsoft.PowerShell.*.dll;
87
+ - task : ArchiveFiles@2
88
+ displayName : Zip module
89
+ inputs :
90
+ rootFolderOrFile : $(Build.SourcesDirectory)/out/Microsoft.PowerShell.TextUtility
91
+ includeRootFolder : false
92
+ archiveType : zip
93
+ archiveFile : out/Microsoft.PowerShell.TextUtility-v$(package.version).zip
94
+ - pwsh : |
95
+ ./build -package -nobuild
96
+ Write-Verbose -Verbose ((Get-Item .).FullName)
97
+ Write-Verbose -Verbose ((Get-Item $(Build.SourcesDirectory)).FullName)
98
+ Get-ChildItem $(Build.SourcesDirectory) -Recurse -File -Name | Write-Verbose -Verbose
99
+ displayName: Package module
100
+ - task : onebranch.pipeline.signing@1
101
+ displayName : Sign NuGet package
102
+ inputs :
103
+ command : sign
104
+ signing_profile : external_distribution
105
+ search_root : $(Build.SourcesDirectory)
106
+ files_to_sign : " **/*.nupkg"
107
+ - stage : release
108
+ dependsOn : build
109
+ variables :
110
+ version : $[ stageDependencies.build.main.outputs['package.version'] ]
111
+ drop : $(Pipeline.Workspace)/drop_build_main
112
+ jobs :
113
+ - job : validation
114
+ displayName : Manual validation
115
+ pool :
116
+ type : agentless
117
+ timeoutInMinutes : 1440
118
+ steps :
119
+ - task : ManualValidation@0
120
+ displayName : Wait 24 hours for validation
121
+ inputs :
122
+ notifyUsers : $(Build.RequestedForEmail)
123
+ instructions : Please validate the release and then publish it!
124
+ timeoutInMinutes : 1440
125
+ - job : publish
126
+ dependsOn : validation
127
+ displayName : Publish to PowerShell Gallery
128
+ pool :
129
+ type : windows
130
+ variables :
131
+ ob_outputDirectory : $(Build.SourcesDirectory)/out/Microsoft.PowerShell.TextUtility
132
+ steps :
133
+ - download : current
134
+ displayName : Download artifacts
135
+ - task : NuGetCommand@2
136
+ displayName : Publish ConsoleGuiTools to PowerShell Gallery
137
+ inputs :
138
+ command : push
139
+ packagesToPush : $(Build.SourcesDirectory)/out/Microsoft.PowerShell.TextUtility.$(package.nupkgVersion).nupkg
140
+ nuGetFeedType : external
141
+ publishFeedCredentials : PowerShellGallery
0 commit comments