From 07b8bcec945da7b519bb9652561d0a54ad088cfd Mon Sep 17 00:00:00 2001 From: Patrick Meinecke Date: Sun, 14 Dec 2025 16:36:26 -0500 Subject: [PATCH 1/2] Update harmony to support up to net10 --- .github/workflows/publish.yml | 26 +++++++++++++++++++ ImpliedReflection.build.ps1 | 22 +++++++++++++--- build.ps1 | 18 ++++++++++--- module/ImpliedReflection.psd1 | 6 +++-- .../ImpliedReflection.csproj | 14 +++++----- 5 files changed, 70 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..e31cf1f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +name: publish +on: + release: + types: [ published ] + +env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + POWERSHELL_TELEMETRY_OPTOUT: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: true + + +defaults: + run: + shell: pwsh + +jobs: + build: + name: Publish + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + - name: Test and Build + run: ./build.ps1 -Force -Publish -Configuration Release + env: + GALLERY_API_KEY: ${{ secrets.GALLERY_API_KEY }} diff --git a/ImpliedReflection.build.ps1 b/ImpliedReflection.build.ps1 index 548032f..61afcdf 100644 --- a/ImpliedReflection.build.ps1 +++ b/ImpliedReflection.build.ps1 @@ -6,7 +6,9 @@ param( [string[]] $Framework, - [string[]] $PowerShellVersion = ('5.1', '7.2.0') + [string[]] $PowerShellVersion = ('5.1', '7.4.12'), + + [switch] $Force ) $moduleName = 'ImpliedReflection' @@ -174,12 +176,24 @@ task DoInstall { } task DoPublish { - if (-not (Test-Path $env:USERPROFILE\.PSGallery\apikey.xml)) { + if ($Configuration -eq 'Debug') { + throw 'Configuration must not be Debug to publish!' + } + + if ($env:GALLERY_API_KEY) { + $apiKey = $env:GALLERY_API_KEY + } else { + $userProfile = [Environment]::GetFolderPath([Environment+SpecialFolder]::UserProfile) + if (Test-Path $userProfile/.PSGallery/apikey.xml) { + $apiKey = (Import-Clixml $userProfile/.PSGallery/apikey.xml).GetNetworkCredential().Password + } + } + + if (-not $apiKey) { throw 'Could not find PSGallery API key!' } - $apiKey = (Import-Clixml $env:USERPROFILE\.PSGallery\apikey.xml).GetNetworkCredential().Password - Publish-Module -Name $Folders.Release -NuGetApiKey $apiKey -Confirm + Publish-Module -Name $Folders.Release -NuGetApiKey $apiKey -Force:$Force.IsPresent -WhatIf } task AssertSMA { diff --git a/build.ps1 b/build.ps1 index 9c3c82c..5cf4a82 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,13 +1,25 @@ [CmdletBinding()] param( - [switch] $Force + [ValidateSet('Debug', 'Release')] + [string] $Configuration = 'Release', + + [Parameter()] + [switch] $Force, + + [Parameter()] + [switch] $Publish ) end { - & "$PSScriptRoot\tools\AssertRequiredModule.ps1" InvokeBuild 5.8.4 -Force + & "$PSScriptRoot\tools\AssertRequiredModule.ps1" InvokeBuild 5.12.2 -Force $invokeBuildSplat = @{ Task = 'Build' File = "$PSScriptRoot/ImpliedReflection.build.ps1" - Configuration = 'Release' + Force = $Force.IsPresent + Configuration = $Configuration + } + + if ($Publish) { + $invokeBuildSplat['Task'] = 'Publish' } Invoke-Build @invokeBuildSplat diff --git a/module/ImpliedReflection.psd1 b/module/ImpliedReflection.psd1 index 09f3ebd..0627bff 100644 --- a/module/ImpliedReflection.psd1 +++ b/module/ImpliedReflection.psd1 @@ -12,7 +12,7 @@ RootModule = 'ImpliedReflection.psm1' # Version number of this module. -ModuleVersion = '1.0.0' +ModuleVersion = '1.0.1' # ID used to uniquely identify this module GUID = '8834a5bf-9bf2-4f09-8415-3c1e561109f6' @@ -75,7 +75,9 @@ PrivateData = @{ # IconUri = '' # ReleaseNotes of this module - ReleaseNotes = '# v1.0.0 + ReleaseNotes = '# v1.0.1 + - Updated Harmony, should work in up to PowerShell v7.6 +# v1.0.0 - Now just works after enabling.' } # End of PSData hashtable diff --git a/src/ImpliedReflection/ImpliedReflection.csproj b/src/ImpliedReflection/ImpliedReflection.csproj index a72a68e..3392a35 100644 --- a/src/ImpliedReflection/ImpliedReflection.csproj +++ b/src/ImpliedReflection/ImpliedReflection.csproj @@ -2,8 +2,8 @@ $(TargetFrameworks);$(ExtraFrameworks) - net471;net6 - + net471;net8 + System.Management.Automation latest false @@ -14,9 +14,9 @@ $(DefineConstants);$(ExtraConstants) - + $(DefineConstants);PS7 - 7.2.0 + 7.4.12 @@ -43,8 +43,8 @@ - - + + @@ -60,7 +60,7 @@ - + From 52242f7843e77d08d36342f132530f480fbd6335 Mon Sep 17 00:00:00 2001 From: Patrick Meinecke Date: Sun, 14 Dec 2025 16:40:27 -0500 Subject: [PATCH 2/2] Update upload artifacts task --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae8d5aa..610efb2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,12 +30,12 @@ jobs: - uses: actions/checkout@v1 - name: Build run: ./build.ps1 -Force - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 if: matrix.os == 'windows-latest' with: name: ImpliedReflection path: ./Release/ImpliedReflection - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 if: matrix.os != 'windows-latest' with: name: ImpliedReflection-${{ matrix.os }}