Skip to content

Commit 17013b9

Browse files
Update Lib.Harmony to version that supports .NET 10 (#13)
* Update harmony to support up to net10 * Update upload artifacts task
1 parent ecb3533 commit 17013b9

File tree

6 files changed

+72
-18
lines changed

6 files changed

+72
-18
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ jobs:
3030
- uses: actions/checkout@v1
3131
- name: Build
3232
run: ./build.ps1 -Force
33-
- uses: actions/upload-artifact@v1
33+
- uses: actions/upload-artifact@v4
3434
if: matrix.os == 'windows-latest'
3535
with:
3636
name: ImpliedReflection
3737
path: ./Release/ImpliedReflection
38-
- uses: actions/upload-artifact@v1
38+
- uses: actions/upload-artifact@v4
3939
if: matrix.os != 'windows-latest'
4040
with:
4141
name: ImpliedReflection-${{ matrix.os }}

.github/workflows/publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: publish
2+
on:
3+
release:
4+
types: [ published ]
5+
6+
env:
7+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
8+
POWERSHELL_TELEMETRY_OPTOUT: 1
9+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
10+
DOTNET_NOLOGO: true
11+
12+
13+
defaults:
14+
run:
15+
shell: pwsh
16+
17+
jobs:
18+
build:
19+
name: Publish
20+
runs-on: windows-latest
21+
steps:
22+
- uses: actions/checkout@v1
23+
- name: Test and Build
24+
run: ./build.ps1 -Force -Publish -Configuration Release
25+
env:
26+
GALLERY_API_KEY: ${{ secrets.GALLERY_API_KEY }}

ImpliedReflection.build.ps1

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ param(
66

77
[string[]] $Framework,
88

9-
[string[]] $PowerShellVersion = ('5.1', '7.2.0')
9+
[string[]] $PowerShellVersion = ('5.1', '7.4.12'),
10+
11+
[switch] $Force
1012
)
1113

1214
$moduleName = 'ImpliedReflection'
@@ -174,12 +176,24 @@ task DoInstall {
174176
}
175177

176178
task DoPublish {
177-
if (-not (Test-Path $env:USERPROFILE\.PSGallery\apikey.xml)) {
179+
if ($Configuration -eq 'Debug') {
180+
throw 'Configuration must not be Debug to publish!'
181+
}
182+
183+
if ($env:GALLERY_API_KEY) {
184+
$apiKey = $env:GALLERY_API_KEY
185+
} else {
186+
$userProfile = [Environment]::GetFolderPath([Environment+SpecialFolder]::UserProfile)
187+
if (Test-Path $userProfile/.PSGallery/apikey.xml) {
188+
$apiKey = (Import-Clixml $userProfile/.PSGallery/apikey.xml).GetNetworkCredential().Password
189+
}
190+
}
191+
192+
if (-not $apiKey) {
178193
throw 'Could not find PSGallery API key!'
179194
}
180195

181-
$apiKey = (Import-Clixml $env:USERPROFILE\.PSGallery\apikey.xml).GetNetworkCredential().Password
182-
Publish-Module -Name $Folders.Release -NuGetApiKey $apiKey -Confirm
196+
Publish-Module -Name $Folders.Release -NuGetApiKey $apiKey -Force:$Force.IsPresent -WhatIf
183197
}
184198

185199
task AssertSMA {

build.ps1

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
[CmdletBinding()]
22
param(
3-
[switch] $Force
3+
[ValidateSet('Debug', 'Release')]
4+
[string] $Configuration = 'Release',
5+
6+
[Parameter()]
7+
[switch] $Force,
8+
9+
[Parameter()]
10+
[switch] $Publish
411
)
512
end {
6-
& "$PSScriptRoot\tools\AssertRequiredModule.ps1" InvokeBuild 5.8.4 -Force
13+
& "$PSScriptRoot\tools\AssertRequiredModule.ps1" InvokeBuild 5.12.2 -Force
714
$invokeBuildSplat = @{
815
Task = 'Build'
916
File = "$PSScriptRoot/ImpliedReflection.build.ps1"
10-
Configuration = 'Release'
17+
Force = $Force.IsPresent
18+
Configuration = $Configuration
19+
}
20+
21+
if ($Publish) {
22+
$invokeBuildSplat['Task'] = 'Publish'
1123
}
1224

1325
Invoke-Build @invokeBuildSplat

module/ImpliedReflection.psd1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'ImpliedReflection.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.0.0'
15+
ModuleVersion = '1.0.1'
1616

1717
# ID used to uniquely identify this module
1818
GUID = '8834a5bf-9bf2-4f09-8415-3c1e561109f6'
@@ -75,7 +75,9 @@ PrivateData = @{
7575
# IconUri = ''
7676

7777
# ReleaseNotes of this module
78-
ReleaseNotes = '# v1.0.0
78+
ReleaseNotes = '# v1.0.1
79+
- Updated Harmony, should work in up to PowerShell v7.6
80+
# v1.0.0
7981
- Now just works after enabling.'
8082

8183
} # End of PSData hashtable

src/ImpliedReflection/ImpliedReflection.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<PropertyGroup>
44
<TargetFrameworks Condition=" '$(ExtraFrameworks)' != '' ">$(TargetFrameworks);$(ExtraFrameworks)</TargetFrameworks>
5-
<TargetFrameworks>net471;net6</TargetFrameworks>
6-
<!-- <TargetFrameworks>net6;net471</TargetFrameworks> -->
5+
<TargetFrameworks>net471;net8</TargetFrameworks>
6+
<!-- <TargetFrameworks>net8;net471</TargetFrameworks> -->
77
<InternalsAssemblyNames>System.Management.Automation</InternalsAssemblyNames>
88
<LangVersion>latest</LangVersion>
99
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
@@ -14,9 +14,9 @@
1414
<DefineConstants Condition=" '$(ExtraConstants)' != '' ">$(DefineConstants);$(ExtraConstants)</DefineConstants>
1515
</PropertyGroup>
1616

17-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6' ">
17+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net8' ">
1818
<DefineConstants>$(DefineConstants);PS7</DefineConstants>
19-
<SMAVersion>7.2.0</SMAVersion>
19+
<SMAVersion>7.4.12</SMAVersion>
2020
</PropertyGroup>
2121

2222
<PropertyGroup Condition=" '$(TargetFramework)' == 'net471' ">
@@ -43,8 +43,8 @@
4343
</ItemGroup>
4444

4545
<ItemGroup Condition=" '$(TargetFramework)' == 'net471' ">
46-
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
47-
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
46+
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
47+
<PackageReference Include="System.Collections.Immutable" Version="9.0.9" />
4848
</ItemGroup>
4949

5050
<ItemGroup>
@@ -60,7 +60,7 @@
6060
</ItemGroup>
6161

6262
<ItemGroup>
63-
<PackageReference Include="Lib.Harmony" Version="2.2.0" />
63+
<PackageReference Include="Lib.Harmony" Version="2.4.2" />
6464
</ItemGroup>
6565

6666

0 commit comments

Comments
 (0)