@@ -411,8 +411,121 @@ extends:
411
411
Write-Verbose -Verbose "Copy completed"
412
412
displayName: Copy artifacts to release area
413
413
414
- - stage : Validation
414
+ - stage : ReleaseUniversalPackage
415
415
dependsOn : ['ReleasePreparation']
416
+ # condition: and(succeeded(), ne(variables['Build.Reason'], 'Schedule'), eq(variables.officialBuild, true))
417
+ variables :
418
+ - name : PackageVersion
419
+ value : $[ stageDependencies.BuildAndSign.SetPackageVersion.outputs['Package.Version'] ]
420
+ jobs :
421
+ - job : ReleaseUniversalPackageJob
422
+ displayName : Release Universal Package job
423
+ pool :
424
+ type : windows
425
+ steps :
426
+ - download : current
427
+ artifact : drop_ReleasePreparation_ReleasePreparationJob
428
+
429
+ - pwsh : |
430
+ $releasePrepPath = "$(Pipeline.Workspace)/drop_ReleasePreparation_ReleasePreparationJob/releasePrep"
431
+ if (-not (Test-Path -Path $releasePrepPath)) {
432
+ throw "Release preparation path '$releasePrepPath' does not exist."
433
+ }
434
+
435
+ $windowsFiles = Get-ChildItem -Path $releasePrepPath -Recurse -Include '*.zip'
436
+ if ($windowsFiles.Count -eq 0) {
437
+ throw "No Windows .zip files found in '$releasePrepPath'. Cannot proceed with Universal Package creation."
438
+ }
439
+
440
+ $linuxFiles = Get-ChildItem -Path $releasePrepPath -Recurse -Include '*linux.tar.gz'
441
+ if ($linuxFiles.Count -eq 0) {
442
+ throw "No Linux .tar.gz files found in '$releasePrepPath'. Cannot proceed with Universal Package creation."
443
+ }
444
+
445
+ $macosFiles = Get-ChildItem -Path $releasePrepPath -Recurse -Include '*darwin.tar.gz'
446
+ if ($macosFiles.Count -eq 0) {
447
+ throw "No macOS .tar.gz files found in '$releasePrepPath'. Cannot proceed with Universal Package creation."
448
+ }
449
+
450
+ $windowsDirectory = New-Item -ItemType Directory -Path "$releasePrepPath/windows" -Force -ErrorAction Ignore
451
+ Write-Host "##vso[task.setvariable variable=WindowsDirectory]$($windowsDirectory.FullName)"
452
+
453
+ $linuxDirectory = New-Item -ItemType Directory -Path "$releasePrepPath/linux" -Force -ErrorAction Ignore
454
+ Write-Host "##vso[task.setvariable variable=LinuxDirectory]$linuxDirectory"
455
+
456
+ $macosDirectory = New-Item -ItemType Directory -Path "$releasePrepPath/macos" -Force -ErrorAction Ignore
457
+ Write-Host "##vso[task.setvariable variable=MacOSDirectory]$macosDirectory"
458
+
459
+ $windowsFiles | ForEach-Object {
460
+ Move-Item -Path $_.FullName -Destination $windowsDirectory.FullName -Force -Verbose
461
+ }
462
+
463
+ $linuxFiles | ForEach-Object {
464
+ Move-Item -Path $_.FullName -Destination $linuxDirectory.FullName -Force -Verbose
465
+ }
466
+
467
+ $macosFiles | ForEach-Object {
468
+ Move-Item -Path $_.FullName -Destination $macosDirectory.FullName -Force -Verbose
469
+ }
470
+
471
+ displayName: Prepare files for Universal Package
472
+
473
+ - task : AzureCLI@2
474
+ displayName : Publish Windows - Universal Package
475
+ inputs :
476
+ azureSubscription : PS-PS-DSC-UniversalFeed
477
+ scriptType : pscore
478
+ scriptLocation : inlineScript
479
+ inlineScript : |
480
+ ## $packageVersion = '$(PackageVersion)'
481
+
482
+ $packageVersion = "0.0.1"
483
+
484
+ if (-not $packageVersion) {
485
+ throw "PackageVersion variable is not set. Cannot proceed with publishing Universal Package."
486
+ }
487
+ Write-Verbose -Verbose "Universal Package version: $packageVersion"
488
+ az artifacts universal publish --organization https://dev.azure.com/PowerShell/ --feed PowerShell-Universal --name Microsoft.DSC-Windows --version $packageVersion --description "Microsoft Desired State Configuration (DSC) - Universal Package" --path "$(WindowsDirectory)"
489
+ condition : succeeded()
490
+
491
+ - task : AzureCLI@2
492
+ displayName : Publish Linux - Universal Package
493
+ inputs :
494
+ azureSubscription : PS-PS-DSC-UniversalFeed
495
+ scriptType : pscore
496
+ scriptLocation : inlineScript
497
+ inlineScript : |
498
+ ## $packageVersion = '$(PackageVersion)'
499
+
500
+ $packageVersion = "0.0.1"
501
+
502
+ if (-not $packageVersion) {
503
+ throw "PackageVersion variable is not set. Cannot proceed with publishing Universal Package."
504
+ }
505
+ Write-Verbose -Verbose "Universal Package version: $packageVersion"
506
+ az artifacts universal publish --organization https://dev.azure.com/PowerShell/ --feed PowerShell-Universal --name Microsoft.DSC-Windows --version $packageVersion --description "Microsoft Desired State Configuration (DSC) - Universal Package" --path "$(LinuxDirectory)"
507
+ condition : succeeded()
508
+
509
+ - task : AzureCLI@2
510
+ displayName : Publish macOS - Universal Package
511
+ inputs :
512
+ azureSubscription : PS-PS-DSC-UniversalFeed
513
+ scriptType : pscore
514
+ scriptLocation : inlineScript
515
+ inlineScript : |
516
+ ## $packageVersion = '$(PackageVersion)'
517
+
518
+ $packageVersion = "0.0.1"
519
+
520
+ if (-not $packageVersion) {
521
+ throw "PackageVersion variable is not set. Cannot proceed with publishing Universal Package."
522
+ }
523
+ Write-Verbose -Verbose "Universal Package version: $packageVersion"
524
+ az artifacts universal publish --organization https://dev.azure.com/PowerShell/ --feed PowerShell-Universal --name Microsoft.DSC-Windows --version $packageVersion --description "Microsoft Desired State Configuration (DSC) - Universal Package" --path "$(MacOSDirectory)"
525
+ condition : succeeded()
526
+
527
+ - stage : Validation
528
+ dependsOn : ['ReleasePreparation', 'ReleaseUniversalPackage']
416
529
condition : and(succeeded(), ne(variables['Build.Reason'], 'Schedule'))
417
530
jobs :
418
531
- job : ValidationJob
@@ -470,23 +583,6 @@ extends:
470
583
Copy-Item -Path $_.FullName -Destination $GitHubReleaseDirectory -Force -Verbose
471
584
}
472
585
473
- $windowsDirName = "Microsoft.DSC-Windows"
474
- $linuxDirName = "Microsoft.DSC-Linux"
475
-
476
- $WindowsReleaseDirectory = New-Item -ItemType Directory -Path "$(Pipeline.Workspace)/$windowsDirName" -Force -ErrorAction Ignore
477
- Write-Host "##vso[task.setvariable variable=WindowsReleaseDirectory]$WindowsReleaseDirectory"
478
-
479
- $artifacts | Where-Object { $_.Extension -eq '.zip' } | ForEach-Object {
480
- Copy-Item -Path $_.FullName -Destination $WindowsReleaseDirectory -Force -Verbose
481
- }
482
-
483
- $LinuxReleaseDirectory = New-Item -ItemType Directory -Path "$(Pipeline.Workspace)/$linuxDirName" -Force -ErrorAction Ignore
484
- Write-Host "##vso[task.setvariable variable=LinuxReleaseDirectory]$LinuxReleaseDirectory"
485
-
486
- $artifacts | Where-Object { $_.Extension -eq '.tar.gz' } | ForEach-Object {
487
- Copy-Item -Path $_.FullName -Destination $LinuxReleaseDirectory -Force -Verbose
488
- }
489
-
490
586
if (-not '$(PackageVersion)') {
491
587
throw "PackageVersion variable is not set. Cannot proceed with release."
492
588
}
@@ -506,26 +602,6 @@ extends:
506
602
507
603
Write-Host "##vso[task.setvariable variable=GitHubReleaseVersion]$githubReleaseVersion"
508
604
509
- - task : UniversalPackages@0
510
- displayName : Publish to Azure Artifacts Universal Packages
511
- inputs :
512
- command : publish
513
- publishDirectory : ' $(LinuxReleaseDirectory)'
514
- vstsFeedPublish : ' PowerShell-DSC-Feed'
515
- vstsFeedPackagePublish : ' microsoft.dsc-linux'
516
- versionOption : custom
517
- versionPublish : ' $(PackageVersion)'
518
-
519
- - task : UniversalPackages@0
520
- displayName : Publish to Azure Artifacts Universal Packages
521
- inputs :
522
- command : publish
523
- publishDirectory : ' $(WindowsReleaseDirectory)'
524
- vstsFeedPublish : ' PowerShell-DSC-Feed'
525
- vstsFeedPackagePublish : ' microsoft.dsc-windows'
526
- versionOption : custom
527
- versionPublish : ' $(PackageVersion)'
528
-
529
605
- task : GitHubRelease@1
530
606
displayName : Create GitHub release
531
607
inputs :
0 commit comments