Skip to content

Commit

Permalink
Migrate to DeployBox for release stage
Browse files Browse the repository at this point in the history
  • Loading branch information
andyleejordan committed Oct 29, 2024
1 parent b6e107d commit f3e1991
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 27 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
run: ./tools/installPSResources.ps1

- name: Download daily install script
if: ${{ github.event_name == 'schedule' || github.event_name == 'merge_group' }}
uses: actions/checkout@v4
with:
repository: PowerShell/PowerShell
Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
bin/
obj/
module/PowerShellEditorServices/NOTICE.txt
module/PowerShellEditorServices/Commands/en-US/
module/PSReadLine/
module/PSScriptAnalyzer/
module/
TestResults/
42 changes: 23 additions & 19 deletions .pipelines/PowerShellEditorServices-Official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ extends:
EnableCDPxPAT: false
WindowsHostVersion:
Version: 2022
Network: Netlock
Network: KS3
release:
category: NonAzure
stages:
- stage: build
jobs:
Expand All @@ -60,7 +62,7 @@ extends:
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/module
ob_outputDirectory: $(Build.SourcesDirectory)/out
steps:
- pwsh: |
[xml]$xml = Get-Content PowerShellEditorServices.Common.props
Expand Down Expand Up @@ -88,9 +90,10 @@ extends:
version: 6.x
- pwsh: |
Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted
Install-Module -Repository CFS -Name InvokeBuild -RequiredVersion 5.11.3
Install-Module -Repository CFS -Name platyPS -RequiredVersion 0.14.2
Invoke-Build TestFull -Configuration $(BuildConfiguration) -PSRepository CFS
Install-Module -Repository CFS -Name Microsoft.PowerShell.PSResourceGet
./tools/installPSResources.ps1 -PSRepository CFS
displayName: Install PSResources
- pwsh: Invoke-Build TestFull -Configuration $(BuildConfiguration) -PSRepository CFS
displayName: Build and test
- task: PublishTestResults@2
displayName: Publish test results
Expand Down Expand Up @@ -131,36 +134,37 @@ extends:
**/OmniSharp.Extensions*.dll;
**/Serilog*.dll;
**/System.Reactive.dll;
- task: ArchiveFiles@2
displayName: Zip signed artifacts
inputs:
rootFolderOrFile: $(Build.SourcesDirectory)/module
includeRootFolder: false
archiveType: zip
archiveFile: out/PowerShellEditorServices.zip
- stage: release
dependsOn: build
condition: eq(variables['Build.Reason'], 'Manual')
variables:
ob_release_environment: Production
version: $[ stageDependencies.build.main.outputs['package.version'] ]
prerelease: $[ stageDependencies.build.main.outputs['package.prerelease'] ]
drop: $(Pipeline.Workspace)/drop_build_main
jobs:
- job: github
displayName: Publish draft to GitHub
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
steps:
- download: current
displayName: Download artifacts
- task: ArchiveFiles@2
displayName: Zip signed artifacts
type: release
templateContext:
inputs:
rootFolderOrFile: $(drop)
includeRootFolder: false
archiveType: zip
archiveFile: out/PowerShellEditorServices.zip
- input: pipelineArtifact
artifactName: drop_build_main
steps:
- task: GitHubRelease@1
displayName: Create GitHub release
inputs:
gitHubConnection: GitHub
repositoryName: PowerShell/PowerShellEditorServices
assets: out/PowerShellEditorServices.zip
target: main
assets: $(Pipeline.Workspace)/PowerShellEditorServices.zip
tagSource: userSpecifiedTag
tag: v$(version)
isDraft: true
Expand Down
6 changes: 4 additions & 2 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ Task AssembleModule -After Build {
New-Item -Force -Path $dir -ItemType Directory | Out-Null
}

# Copy third party notices to module folder
Copy-Item -Force -Path "NOTICE.txt" -Destination $psesOutputPath
# Copy documents to module root
foreach ($document in @("LICENSE", "NOTICE.txt", "README.md", "SECURITY.md")) {
Copy-Item -Force -Path $document -Destination "./module"
}

# Assemble PSES module
$includedDlls = [System.Collections.Generic.HashSet[string]]::new()
Expand Down
12 changes: 10 additions & 2 deletions tools/installPSResources.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
param(
[ValidateSet("PSGallery", "CFS")]
[string]$PSRepository = "PSGallery"
)

Install-PSResource -TrustRepository -Name InvokeBuild -Scope CurrentUser
Install-PSResource -TrustRepository -Name platyPS -Scope CurrentUser
if ($PSRepository -eq "CFS" -and -not (Get-PSResourceRepository -Name CFS -ErrorAction SilentlyContinue)) {
Register-PSResourceRepository -Name CFS -Uri "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v3/index.json"
}

Install-PSResource -Repository $PSRepository -TrustRepository -Name InvokeBuild
Install-PSResource -Repository $PSRepository -TrustRepository -Name platyPS

0 comments on commit f3e1991

Please sign in to comment.