master
yml 71 lines 2.04 KB
Raw
1 trigger:
2 branches:
3 include:
4 - master
5
6 variables:
7 targetBranch: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]
8
9 pool:
10 vmImage: 'windows-latest'
11
12 steps:
13 - checkout : self
14 persistCredentials: true
15
16 - task: ComponentGovernanceComponentDetection@0
17 displayName: Component Detection
18
19 # Append the WSLg NuGet's NOTICE: it covers Linux OSS shipped as binaries, which
20 # Component Governance doesn't detect.
21 - task: NuGetToolInstaller@1
22 displayName: Install NuGet
23
24 - task: NuGetCommand@2
25 displayName: Restore packages (for the WSLg NOTICE)
26 inputs:
27 command: restore
28 restoreSolution: packages.config
29 feedsToUse: config
30 nugetConfigPath: NuGet.Config
31 restoreDirectory: $(Build.SourcesDirectory)/packages
32
33 - powershell: |
34 $version = ([xml](Get-Content packages.config)).packages.package |
35 Where-Object { $_.id -eq 'Microsoft.WSLg' } |
36 Select-Object -ExpandProperty version
37 $notice = "$(Build.SourcesDirectory)/packages/Microsoft.WSLg.$version/NOTICE.txt"
38 if (-not (Test-Path $notice)) {
39 Write-Error "WSLg NOTICE not found at $notice"
40 exit 1
41 }
42 Write-Host "##vso[task.setvariable variable=WslgNoticePath]$notice"
43 displayName: Resolve WSLg NOTICE path
44
45 - task: notice@0
46 displayName: Generate NOTICE file
47 inputs:
48 outputfile: $(System.DefaultWorkingDirectory)/NOTICE.txt
49 outputformat: text
50 additionaldata: $(WslgNoticePath)
51
52 - task: PipAuthenticate@1
53 inputs:
54 artifactFeeds: 'wsl'
55
56 - task: AzureKeyVault@2
57 displayName: Fetch GitHub PR token from Key Vault
58 inputs:
59 azureSubscription: 'Azure-Connection'
60 KeyVaultName: 'wsl-ci-key-vault'
61 SecretsFilter: 'GithubPRToken'
62
63 - powershell: |
64 pip install --user -r tools/devops/requirements.txt
65 python tools/devops/create-change.py . "$env:token" "WSL notice" "Notice change from build: $env:buildId" "user/notice/$env:buildId" "$env:targetBranch"
66
67 displayName: Create pull request
68 env:
69 token: $(GithubPRToken)
70 buildId: $(Build.BuildId)
71 targetBranch: $(targetBranch)