-
Notifications
You must be signed in to change notification settings - Fork 158
Release build for platyPS v2 #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
adityapatwardhan
merged 12 commits into
PowerShell:v2
from
adityapatwardhan:ReleaseBuild
May 18, 2021
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b7ccaed
Release build
adityapatwardhan e579fdd
More fixes
adityapatwardhan f883941
Add publish template
adityapatwardhan 88a765e
Comment out ESRP signing tasks
adityapatwardhan d404bb0
Fix typo
adityapatwardhan af2b2e0
Fix package name
adityapatwardhan 4aec213
Add signing tasks
adityapatwardhan c044398
Fix minimatch pattern
adityapatwardhan 4778a80
Make sure signed files are merge together
adityapatwardhan 0af33eb
Make sure all signed files are added to the package
adityapatwardhan 7cbd350
Address CR comments
adityapatwardhan ba2c637
Fix pool names and ImageOverride conditions
adityapatwardhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
name: PlatyPS-Release-$(Build.BuildId) | ||
trigger: none | ||
|
||
pr: | ||
branches: | ||
include: | ||
- v2 | ||
- release/v2/* | ||
|
||
variables: | ||
- group: ESRP | ||
- name: DOTNET_CLI_TELEMETRY_OPTOUT | ||
value: 1 | ||
- name: POWERSHELL_TELEMETRY_OPTOUT | ||
value: 1 | ||
|
||
resources: | ||
repositories: | ||
- repository: ComplianceRepo | ||
type: github | ||
endpoint: ComplianceGHRepo | ||
name: PowerShell/compliance | ||
|
||
stages: | ||
- stage: Build | ||
displayName: Build | ||
pool: | ||
name: 1ES | ||
demands: | ||
- ImageOverride -equals MMS2019 | ||
jobs: | ||
- job: Build_Job | ||
displayName: Build PlatyPS | ||
steps: | ||
- checkout: self | ||
clean: true | ||
- pwsh: | | ||
$versionString = if ($env:RELEASE_VERSION -eq 'fromBranch') { | ||
$branch = $env:BUILD_SOURCEBRANCH | ||
$branchOnly = $branch -replace '^refs/heads/' | ||
$branchOnly -replace '^.*(release/v2[-/])' | ||
} | ||
else { | ||
$env:RELEASE_VERSION | ||
} | ||
|
||
$nugetVersion = if ($versionString.StartsWith('v')) { | ||
$versionString.Substring(1) | ||
} | ||
else { | ||
$versionString | ||
} | ||
|
||
$vstsCommandString = "vso[task.setvariable variable=Version]$nugetVersion" | ||
Write-Verbose -Message "setting Version to $releaseTag" -Verbose | ||
Write-Host -Object "##$vstsCommandString" | ||
displayName: Set NuGet package version variable | ||
|
||
- pwsh: | | ||
./build.ps1 -Clean -Configuration 'Release' | ||
displayName: Execute build | ||
|
||
- publish: '$(Build.SourcesDirectory)\out\platyPS' | ||
artifact: build | ||
displayName: Publish build package | ||
|
||
- template: EsrpSign.yml@ComplianceRepo | ||
parameters: | ||
buildOutputPath: '$(Build.SourcesDirectory)\out\platyPS' | ||
signOutputPath: '$(Pipeline.Workspace)\signed\codesign' | ||
certificateId: 'CP-230012' | ||
displayName: Microsoft signing | ||
pattern: | | ||
**\Microsoft.PowerShell.PlatyPS.dll | ||
**\platyPS.psd1 | ||
useMinimatch: true | ||
|
||
- template: EsrpSign.yml@ComplianceRepo | ||
parameters: | ||
buildOutputPath: '$(Build.SourcesDirectory)\out\platyPS' | ||
signOutputPath: '$(Pipeline.Workspace)\signed\thirdparty' | ||
certificateId: 'CP-231522' | ||
adityapatwardhan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
displayName: Third party signing | ||
pattern: | | ||
**\Markdig.Signed.dll | ||
**\YamlDotNet.dll | ||
useMinimatch: true | ||
|
||
- pwsh: | | ||
Copy-Item -Path "$env:BUILD_SOURCESDIRECTORY\out\platyPS" -Destination "$env:PIPELINE_WORKSPACE\signed" -recurse -verbose -force | ||
displayName: Dummy copy to signed | ||
condition: eq(variables['SkipSigning'], 'True') | ||
|
||
- pwsh: | | ||
$null = New-Item -ItemType Directory -Path '$(System.ArtifactsDirectory)/signedpackage/platyPS' -Force | ||
|
||
if ( Test-Path -Path '$(Pipeline.Workspace)\signed\codesign') | ||
{ | ||
Copy-Item -Path '$(Pipeline.Workspace)\signed\codesign\Microsoft.PowerShell.PlatyPS.dll' -Destination '$(System.ArtifactsDirectory)/signedpackage/platyPS' -Verbose -Force | ||
Copy-Item -Path '$(Pipeline.Workspace)\signed\codesign\platyPS.psd1' -Destination '$(System.ArtifactsDirectory)/signedpackage/platyPS' -Verbose -Force | ||
Copy-Item -Path '$(Pipeline.Workspace)\signed\thirdparty\Markdig.Signed.dll' -Destination '$(System.ArtifactsDirectory)/signedpackage/platyPS' -Verbose -Force | ||
Copy-Item -Path '$(Pipeline.Workspace)\signed\thirdparty\YamlDotNet.dll' -Destination '$(System.ArtifactsDirectory)/signedpackage/platyPS' -Verbose -Force | ||
} | ||
else | ||
{ | ||
Copy-Item -Path '$(Pipeline.Workspace)\signed\*' -Destination '$(System.ArtifactsDirectory)/signedpackage/platyPS' -Verbose -Force | ||
} | ||
displayName: Copy signed files to module folder | ||
|
||
- publish: '$(Pipeline.Workspace)\signed' | ||
artifact: signed | ||
displayName: Publish signed package | ||
condition: ne(variables['SkipSigning'], 'True') | ||
|
||
- publish: '$(Build.SourcesDirectory)\src\obj\project.assets.json' | ||
artifact: AssetsJson | ||
displayName: Publish project.assets.json | ||
|
||
- pwsh: | | ||
$null = New-Item -ItemType Directory -Path '$(System.ArtifactsDirectory)/local' | ||
Register-PSRepository -Name local -SourceLocation '$(System.ArtifactsDirectory)/local' -Verbose -ErrorAction Ignore | ||
Publish-Module -Repository local -Path '$(System.ArtifactsDirectory)/signedpackage/platyPS' -Verbose | ||
displayName: Create nupkg for the module | ||
|
||
- publish: '$(System.ArtifactsDirectory)\local\platyPS.$(Version).nupkg' | ||
artifact: nuget | ||
displayName: Publish module nuget | ||
|
||
- stage: compliance | ||
displayName: Compliance | ||
dependsOn: Build | ||
jobs: | ||
- job: Compliance_Job | ||
pool: | ||
name: 1ES | ||
demands: | ||
- ImageOverride -equals MMS2019 | ||
steps: | ||
- checkout: self | ||
- checkout: ComplianceRepo | ||
|
||
- task: DownloadPipelineArtifact@2 | ||
displayName: 'Download AssetsJson artifacts' | ||
inputs: | ||
artifact: AssetsJson | ||
path: '$(Pipeline.Workspace)/AssetsJson' | ||
|
||
- task: DownloadPipelineArtifact@2 | ||
displayName: 'Download build artifacts' | ||
inputs: | ||
artifact: build | ||
path: '$(Pipeline.Workspace)/build' | ||
|
||
- pwsh: | | ||
Get-ChildItem -Recurse '$(Pipeline.Workspace)' | ||
displayName: Capture downloaded artifacts | ||
|
||
- template: assembly-module-compliance.yml@ComplianceRepo | ||
parameters: | ||
# binskim | ||
AnalyzeTarget: '$(Pipeline.Workspace)/build/*.dll' | ||
AnalyzeSymPath: 'SRV*' | ||
# component-governance | ||
sourceScanPath: '$(Pipeline.Workspace)/AssetsJson' | ||
# credscan | ||
suppressionsFile: '' | ||
# TermCheck | ||
optionsRulesDBPath: '' | ||
optionsFTPath: '' | ||
# tsa-upload | ||
codeBaseName: 'PlatyPS_202105' | ||
# selections | ||
APIScan: false # set to false when not using Windows APIs. | ||
|
||
- template: template/publish.yml | ||
parameters: | ||
stageName: NuGet | ||
environmentName: PlatyPSNuGetApproval | ||
feedCredential: NugetOrgPush |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
parameters: | ||
stageName: '' | ||
environmentName: '' | ||
feedCredential: '' | ||
|
||
stages: | ||
- stage: ${{ parameters.stageName }} | ||
displayName: Release Microsoft.PowerShell.Pager to '${{ parameters.stageName }}' | ||
condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/v2')) | ||
|
||
jobs: | ||
- deployment: Publish_${{ parameters.stageName }} | ||
displayName: Release to Feed | ||
pool: | ||
name: 1ES | ||
|
||
environment: ${{ parameters.environmentName }} | ||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
- download: current | ||
artifact: nuget | ||
|
||
- pwsh: | | ||
Get-ChildItem -Recurse "$(Pipeline.Workspace)/nuget" | ||
displayName: Capture downloaded artifact | ||
|
||
- task: NuGetAuthenticate@0 | ||
condition: ne('${{ parameters.feedUrl }}', '') | ||
|
||
- pwsh: | | ||
nuget push -ApiKey AzureArtifacts -source '${{ parameters.feedUrl }}' '$(NugetPkgPath)' | ||
displayName: Push to internal feed | ||
condition: ne('${{ parameters.feedUrl }}', '') | ||
- task: NuGetCommand@2 | ||
displayName: 'NuGet push' | ||
inputs: | ||
command: push | ||
packagesToPush: '$(Build.ArtifactStagingDirectory)/Microsoft.PowerShell.Pager.*.nupkg' | ||
nuGetFeedType: external | ||
publishFeedCredentials: ${{ parameters.feedCredential }} | ||
condition: eq('${{ parameters.feedUrl }}', '') |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.