| 1 | parameters: |
| 2 | - name: isNightly |
| 3 | type: boolean |
| 4 | default: false |
| 5 | |
| 6 | - name: nugetPackages |
| 7 | type: object |
| 8 | default: |
| 9 | - Microsoft.WSL.PluginApi |
| 10 | - Microsoft.WSL.Containers |
| 11 | |
| 12 | stages: |
| 13 | - stage: nuget |
| 14 | dependsOn: [package, test] |
| 15 | jobs: |
| 16 | - job: nuget |
| 17 | displayName: 'Publish nuget packages' |
| 18 | condition: and(succeeded(), or(eq(variables['Build.Reason'], 'Schedule'), eq('${{ parameters.isNightly }}', false))) |
| 19 | dependsOn: [] # The stage handles this dependency |
| 20 | |
| 21 | pool: |
| 22 | type: windows |
| 23 | |
| 24 | variables: |
| 25 | WSL_NUGET_PACKAGE_VERSION: $[ stageDependencies.package.package.outputs['version.WSL_NUGET_PACKAGE_VERSION'] ] |
| 26 | NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS: 60 |
| 27 | NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS: 60 |
| 28 | ob_outputDirectory: '$(Build.SourcesDirectory)\out' |
| 29 | ob_artifactBaseName: 'drop_wsl' |
| 30 | ob_artifactSuffix: '_nuget' |
| 31 | # The per-stage SDL CodeSign post-analysis scans the checked-out repo, which contains unsigned |
| 32 | # helper .ps1 scripts. The pipeline-level exclude does not flow into per-stage SDL, so it must be |
| 33 | # set on this job as well (mirrors build-job.yml). The published .nupkg files remain validated. |
| 34 | ob_sdl_codeSignValidation_excludes: -|**\*.ps1 |
| 35 | |
| 36 | steps: |
| 37 | |
| 38 | - task: DownloadPipelineArtifact@2 |
| 39 | displayName: Download nuget artifacts |
| 40 | inputs: |
| 41 | artifact: "drop_wsl_package" |
| 42 | path: $(Build.SourcesDirectory)\drop |
| 43 | |
| 44 | # Note: this task might fail if there's been no commits between two nightly pipelines, which is fine. |
| 45 | - ${{ each package in parameters.nugetPackages }}: |
| 46 | - task: NuGetCommand@2 |
| 47 | displayName: Push nuget/${{ package }}.*.nupkg |
| 48 | inputs: |
| 49 | command: 'push' |
| 50 | packagesToPush: $(Build.SourcesDirectory)\drop\nuget\${{ package }}.$(WSL_NUGET_PACKAGE_VERSION).nupkg |
| 51 | nuGetFeedType: 'internal' |
| 52 | publishVstsFeed: wsl |
| 53 | allowPackageConflicts: ${{ parameters.isNightly }} |