From 71cc6d3c905e84535591da372fbddf3feb8a4aaf Mon Sep 17 00:00:00 2001 From: "Joseph L. Casale" <9957114+jcasale@users.noreply.github.com> Date: Tue, 11 Nov 2025 19:52:55 -0700 Subject: [PATCH 1/6] Updates wix toolset to v6.0.2. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 27c8eca..0a8b742 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,9 +23,9 @@ jobs: - name: Setup wix run: | - dotnet.exe tool install --global wix --version 6.0.0 --verbosity diag + dotnet.exe tool install --global wix --version 6.0.2 --verbosity diag - wix.exe extension add WixToolset.UI.wixext/6.0.0 --global + wix.exe extension add WixToolset.UI.wixext/6.0.2 --global wix.exe extension list --global - name: Generate version property From b24ac127cefbad2c7a11841661580b2465226806 Mon Sep 17 00:00:00 2001 From: "Joseph L. Casale" <9957114+jcasale@users.noreply.github.com> Date: Tue, 11 Nov 2025 20:01:15 -0700 Subject: [PATCH 2/6] Simplifies test setup. --- src/Tests/IntegrationTests.cs | 15 +++------------ src/Tests/ParameterTests.cs | 15 +++------------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/src/Tests/IntegrationTests.cs b/src/Tests/IntegrationTests.cs index e1b1d82..75e7ab5 100644 --- a/src/Tests/IntegrationTests.cs +++ b/src/Tests/IntegrationTests.cs @@ -10,12 +10,11 @@ namespace Tests; public sealed class IntegrationTests : IDisposable { - private readonly Runspace runSpace; private readonly PowerShell powerShell; public IntegrationTests() { - var initialSessionState = InitialSessionState.Create(); + var initialSessionState = InitialSessionState.CreateDefault2(); var entry1 = new SessionStateCmdletEntry("New-DataProtectionSecret", typeof(NewDataProtectionSecretCommand), null); initialSessionState.Commands.Add(entry1); @@ -23,11 +22,7 @@ public IntegrationTests() var entry2 = new SessionStateCmdletEntry("Read-DataProtectionSecret", typeof(ReadDataProtectionSecretCommand), null); initialSessionState.Commands.Add(entry2); - this.runSpace = RunspaceFactory.CreateRunspace(initialSessionState); - this.powerShell = PowerShell.Create(); - - this.runSpace.Open(); - this.powerShell.Runspace = this.runSpace; + this.powerShell = PowerShell.Create(initialSessionState); } public static TheoryData NewDataProtectionSecretArguments() => new() @@ -182,9 +177,5 @@ public void SecureStringAsObjectInPipelineShouldPass(string data, DataProtection } /// - public void Dispose() - { - this.powerShell.Dispose(); - this.runSpace.Dispose(); - } + public void Dispose() => this.powerShell.Dispose(); } \ No newline at end of file diff --git a/src/Tests/ParameterTests.cs b/src/Tests/ParameterTests.cs index dcced93..c660370 100644 --- a/src/Tests/ParameterTests.cs +++ b/src/Tests/ParameterTests.cs @@ -9,12 +9,11 @@ namespace Tests; public sealed class ParameterTests : IDisposable { - private readonly Runspace runSpace; private readonly PowerShell powerShell; public ParameterTests() { - var initialSessionState = InitialSessionState.Create(); + var initialSessionState = InitialSessionState.CreateDefault2(); var entry1 = new SessionStateCmdletEntry("New-DataProtectionSecret", typeof(NewDataProtectionSecretCommand), null); initialSessionState.Commands.Add(entry1); @@ -22,11 +21,7 @@ public ParameterTests() var entry2 = new SessionStateCmdletEntry("Read-DataProtectionSecret", typeof(ReadDataProtectionSecretCommand), null); initialSessionState.Commands.Add(entry2); - this.runSpace = RunspaceFactory.CreateRunspace(initialSessionState); - this.powerShell = PowerShell.Create(); - - this.runSpace.Open(); - this.powerShell.Runspace = this.runSpace; + this.powerShell = PowerShell.Create(initialSessionState); } [Fact] @@ -120,9 +115,5 @@ public void ReadDataProtectionSecretWithInvalidScopeShouldThrow() } /// - public void Dispose() - { - this.powerShell.Dispose(); - this.runSpace.Dispose(); - } + public void Dispose() => this.powerShell.Dispose(); } \ No newline at end of file From 792561e35889187d1c5e2dc6809a23ddc4ffb332 Mon Sep 17 00:00:00 2001 From: "Joseph L. Casale" <9957114+jcasale@users.noreply.github.com> Date: Tue, 11 Nov 2025 20:03:23 -0700 Subject: [PATCH 3/6] Updates workflow. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a8b742..8246277 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 From 544eaa7b5d5f4223c2f83a746e06e64d76fd163e Mon Sep 17 00:00:00 2001 From: "Joseph L. Casale" <9957114+jcasale@users.noreply.github.com> Date: Tue, 11 Nov 2025 20:18:23 -0700 Subject: [PATCH 4/6] Adds support for pre-release info to git tag parser. --- .github/workflows/main.yml | 10 ++++++++-- src/PSDataProtection/PSDataProtection.csproj | 14 ++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8246277..2db244f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,10 +31,16 @@ jobs: - name: Generate version property id: version run: | + $pattern = '^v(((\d+\.\d+\.\d+\.\d+)(?:-[a-z]+\.\d+)?)-(\d+-g.+))' $tag = git.exe describe --tags --long - $version = [version]::new($tag.Split('-')[0].TrimStart('v')) + $version = [System.Text.RegularExpressions.Regex]::Match($tag, $pattern).Groups[3].Value + $fullVersion = [System.Text.RegularExpressions.Regex]::Match($tag, $pattern).Groups[2].Value + $gitCommitInfo = [System.Text.RegularExpressions.Regex]::Match($tag, $pattern).Groups[4].Value + $informationalVersion = '{0}+{1}' -f $fullVersion,$gitCommitInfo echo "version=$version" >> $env:GITHUB_OUTPUT + echo "fullVersion=$fullVersion" >> $env:GITHUB_OUTPUT + echo "informationalVersion=$informationalVersion" >> $env:GITHUB_OUTPUT - name: Run tests run: dotnet.exe test .\src\PSDataProtection.sln --configuration Release --runtime win-x64 @@ -100,7 +106,7 @@ jobs: - name: Publish release if: github.ref_type == 'tag' - run: gh.exe release create v${{ steps.version.outputs.version }} --title v${{ steps.version.outputs.version }} --notes 'PowerShell data protection module.' ps-data-protection.msi + run: gh.exe release create v${{ steps.version.outputs.fullVersion }} --title v${{ steps.version.outputs.fullVersion }} --notes 'PowerShell data protection module.' ps-data-protection.msi env: # Requires a personal access token with a fine-grained permission of contents:read/write. GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} diff --git a/src/PSDataProtection/PSDataProtection.csproj b/src/PSDataProtection/PSDataProtection.csproj index 6a67a26..096ebae 100644 --- a/src/PSDataProtection/PSDataProtection.csproj +++ b/src/PSDataProtection/PSDataProtection.csproj @@ -27,16 +27,18 @@ - + - ^v((.+)-(\d+)-g(.+)) - $([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[2].Value) - $([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[2].Value) - $([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[2].Value) - $([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[1].Value) + ^v(((\d+\.\d+\.\d+\.\d+)(?:-[a-z]+\.\d+)?)-(\d+-g.+)) + $([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[3].Value) + $([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[3].Value) + $([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[3].Value) + $([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[2].Value) + $([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(PatternGitTag)).Groups[4].Value) + $(FullVersion)+$(GitCommitInfo) From b05d509369d5e644190fecda699333ad5aa173d8 Mon Sep 17 00:00:00 2001 From: "Joseph L. Casale" <9957114+jcasale@users.noreply.github.com> Date: Tue, 11 Nov 2025 20:24:06 -0700 Subject: [PATCH 5/6] Updates dependencies. --- src/PSDataProtection/PSDataProtection.csproj | 2 +- src/Tests/Tests.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PSDataProtection/PSDataProtection.csproj b/src/PSDataProtection/PSDataProtection.csproj index 096ebae..89451cf 100644 --- a/src/PSDataProtection/PSDataProtection.csproj +++ b/src/PSDataProtection/PSDataProtection.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index 0aa8581..9df6bd9 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -9,9 +9,9 @@ - + - + runtime; build; native; contentfiles; analyzers; buildtransitive From 585327e9bb8c4c7c3208970e6b29218722d41642 Mon Sep 17 00:00:00 2001 From: "Joseph L. Casale" <9957114+jcasale@users.noreply.github.com> Date: Tue, 11 Nov 2025 20:27:13 -0700 Subject: [PATCH 6/6] Adds explicit .NET SDK version. --- .github/workflows/main.yml | 6 ++++++ src/global.json | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 src/global.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2db244f..c92dbae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,6 +21,12 @@ jobs: with: fetch-depth: 0 + - name: Setup dotnet + id: setup-dotnet + uses: actions/setup-dotnet@v5 + with: + global-json-file: src/global.json + - name: Setup wix run: | dotnet.exe tool install --global wix --version 6.0.2 --verbosity diag diff --git a/src/global.json b/src/global.json new file mode 100644 index 0000000..c3e62a0 --- /dev/null +++ b/src/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "10.0.100", + "rollForward": "latestFeature", + "allowPrerelease": true + } +} \ No newline at end of file