PowerShell/tools/releaseBuild/azureDevOps/templates/mac-file-signing.yml
2020-12-07 12:11:54 -08:00

103 lines
3.6 KiB
YAML

parameters:
parentJob: ''
jobs:
- job: MacFileSigningJob
displayName: macOS File signing
dependsOn: ${{ parameters.parentJob }}
condition: succeeded()
pool:
name: Package ES Standard Build
variables:
- group: ESRP
steps:
- checkout: self
clean: true
- checkout: ComplianceRepo
clean: true
- template: shouldSign.yml
- template: SetVersionVariables.yml
parameters:
ReleaseTagVar: $(ReleaseTagVar)
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'macosBinResults'
itemPattern: '**/*.zip'
downloadPath: '$(System.ArtifactsDirectory)\Symbols'
- pwsh: |
Get-ChildItem "$(System.ArtifactsDirectory)\*" -Recurse
displayName: 'Capture Downloaded Artifacts'
# Diagnostics is not critical it passes every time it runs
continueOnError: true
- pwsh: |
$zipPath = Get-Item '$(System.ArtifactsDirectory)\Symbols\macosBinResults\*symbol*.zip'
Write-Verbose -Verbose "Zip Path: $zipPath"
$expandedFolder = $zipPath.BaseName
Write-Host "sending.. vso[task.setvariable variable=SymbolsFolder]$expandedFolder"
Write-Host "##vso[task.setvariable variable=SymbolsFolder]$expandedFolder"
Expand-Archive -Path $zipPath -Destination "$(System.ArtifactsDirectory)\$expandedFolder" -Force
displayName: Expand symbols zip
- pwsh: |
Get-ChildItem "$(System.ArtifactsDirectory)\*" -Recurse
displayName: 'Capture artifacts dir Binaries'
- pwsh: |
Get-ChildItem "$(System.ArtifactsDirectory)\$(SymbolsFolder)" -Recurse -Include pwsh, *.dylib
displayName: 'Capture Expanded Binaries'
# Diagnostics is not critical it passes every time it runs
continueOnError: true
- pwsh: |
$null = new-item -type directory -path "$(Build.StagingDirectory)\macos"
$zipFile = "$(Build.StagingDirectory)\macos\powershell-files-$(Version)-osx-x64.zip"
Get-ChildItem "$(System.ArtifactsDirectory)\$(SymbolsFolder)" -Recurse -Include pwsh, *.dylib |
Compress-Archive -Destination $zipFile
Write-Host $zipFile
displayName: 'Compress macOS binary files'
- template: EsrpSign.yml@ComplianceRepo
parameters:
buildOutputPath: $(Build.StagingDirectory)\macos
signOutputPath: $(Build.StagingDirectory)\signedMacOSPackages
certificateId: "CP-401337-Apple"
pattern: |
**\*.zip
useMinimatch: true
- pwsh: |
$destination = "$(System.ArtifactsDirectory)\azureMacOs"
New-Item -Path $destination -Type Directory
$zipPath = Get-ChildItem "$(Build.StagingDirectory)\signedMacOSPackages\powershell-*.zip" -Recurse | select-object -expandproperty fullname
foreach ($z in $zipPath) { Expand-Archive -Path $z -DestinationPath $destination }
displayName: 'Extract and copy macOS artifacts for upload'
condition: and(succeeded(), eq(variables['SHOULD_SIGN'], 'true'))
- template: upload-final-results.yml
parameters:
artifactPath: $(System.ArtifactsDirectory)\azureMacOs
artifactFilter: "*"
artifactName: signedMacOsBins
condition: and(succeeded(), eq(variables['SHOULD_SIGN'], 'true'))
- template: EsrpScan.yml@ComplianceRepo
parameters:
scanPath: $(System.ArtifactsDirectory)\azureMacOs
pattern: |
**\*
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection'
inputs:
sourceScanPath: '$(Build.SourcesDirectory)'
snapshotForceEnabled: true