|
| 1 | +name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) |
| 2 | + |
| 3 | +trigger: none |
| 4 | + |
| 5 | +resources: |
| 6 | + repositories: |
| 7 | + - repository: ComplianceRepo |
| 8 | + type: github |
| 9 | + endpoint: ComplianceGHRepo |
| 10 | + name: PowerShell/compliance |
| 11 | + |
| 12 | +variables: |
| 13 | + - name: PackageName |
| 14 | + value: 'Microsoft.PowerShell.Archive' |
| 15 | + - name: PackageVersion |
| 16 | + value: '' |
| 17 | + - name: BuildOutDir |
| 18 | + value: '' |
| 19 | + |
| 20 | +stages: |
| 21 | +- stage: Build |
| 22 | + displayName: Build module |
| 23 | + pool: |
| 24 | + name: 1ES |
| 25 | + demands: |
| 26 | + - ImageOverride -equals PSMMS2019-Secure |
| 27 | + jobs: |
| 28 | + - job: BuildPkg |
| 29 | + displayName: Build module |
| 30 | + steps: |
| 31 | + |
| 32 | + - pwsh: | |
| 33 | + & $(Build.SourcesDirectory)\SimpleBuild.ps1 |
| 34 | + displayName: Build Microsoft.PowerShell.Archive module |
| 35 | + condition: succeededOrFailed() |
| 36 | +
|
| 37 | + - pwsh: | |
| 38 | + dir "$(BuildOutDir)\*" -Recurse |
| 39 | + displayName: Show BuildOutDirectory |
| 40 | +
|
| 41 | + - template: Sbom.yml@ComplianceRepo |
| 42 | + parameters: |
| 43 | + BuildDropPath: "$(BuildOutDir)" |
| 44 | + Build_Repository_Uri: 'https://github.com/PowerShell/Microsoft.PowerShell.Archive' |
| 45 | + PackageName: $(PackageName) |
| 46 | + PackageVersion: $(PackageVersion) |
| 47 | + |
| 48 | + - pwsh: | |
| 49 | + dir "$(BuildOutDir)\*" -Recurse |
| 50 | + displayName: Show BuildOutDirectory |
| 51 | +
|
| 52 | + - pwsh: | |
| 53 | + $signSrcPath = "$(BuildOutDir)" |
| 54 | + # Set signing src path variable |
| 55 | + $vstsCommandString = "vso[task.setvariable variable=signSrcPath]${signSrcPath}" |
| 56 | + Write-Host "sending " + $vstsCommandString |
| 57 | + Write-Host "##$vstsCommandString" |
| 58 | + $signOutPath = "$(Build.SourcesDirectory)\signed\Microsoft.PowerShell.Archive" |
| 59 | + $null = New-Item -ItemType Directory -Path $signOutPath |
| 60 | + # Set signing out path variable |
| 61 | + $vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}" |
| 62 | + Write-Host "sending " + $vstsCommandString |
| 63 | + Write-Host "##$vstsCommandString" |
| 64 | + # Set path variable for guardian codesign validation |
| 65 | + $vstsCommandString = "vso[task.setvariable variable=GDN_CODESIGN_TARGETDIRECTORY]${signOutPath}" |
| 66 | + Write-Host "sending " + $vstsCommandString |
| 67 | + Write-Host "##$vstsCommandString" |
| 68 | + displayName: Setup variables for signing |
| 69 | +
|
| 70 | + - pwsh: | |
| 71 | + Copy-Item -Path "$(signSrcPath)\*" -Destination "$(signOutPath)" |
| 72 | + displayName: Fake Signing |
| 73 | +
|
| 74 | + - pwsh: | |
| 75 | + Compress-Archive -Path "$(signOutPath)\*" -DestinationPath "$(System.ArtifactsDirectory)\Microsoft.PowerShell.Archive.zip" |
| 76 | + displayName: Create Microsoft.PowerShell.Archive.zip |
| 77 | +
|
| 78 | + - publish: $(System.ArtifactsDirectory)\Microsoft.PowerShell.Archive.zip |
| 79 | + artifact: SignedModule |
0 commit comments