diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 6a6b0936f..2c504a075 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -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 diff --git a/.gitignore b/.gitignore index 1b97c3908..d8c2d5b16 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ bin/ obj/ -module/PowerShellEditorServices/NOTICE.txt -module/PowerShellEditorServices/Commands/en-US/ -module/PSReadLine/ -module/PSScriptAnalyzer/ +module/ TestResults/ diff --git a/.pipelines/PowerShellEditorServices-Official.yml b/.pipelines/PowerShellEditorServices-Official.yml index 5c8fe0655..79e2a85a3 100644 --- a/.pipelines/PowerShellEditorServices-Official.yml +++ b/.pipelines/PowerShellEditorServices-Official.yml @@ -51,7 +51,9 @@ extends: EnableCDPxPAT: false WindowsHostVersion: Version: 2022 - Network: Netlock + Network: KS3 + release: + category: NonAzure stages: - stage: build jobs: @@ -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 @@ -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 @@ -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 diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index 72648411d..02a5d6436 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -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() diff --git a/tools/installPSResources.ps1 b/tools/installPSResources.ps1 index 5456cac13..e98910d70 100644 --- a/tools/installPSResources.ps1 +++ b/tools/installPSResources.ps1 @@ -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