diff --git a/.editorconfig b/.editorconfig index be3f3ed..f46bf08 100644 --- a/.editorconfig +++ b/.editorconfig @@ -422,4 +422,7 @@ indent_size = 2 indent_size = 2 [*.json] +indent_size = 2 + +[*.yml] indent_size = 2 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f0a034..90ccf8b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,15 +23,10 @@ jobs: - name: Setup wix run: | - dotnet.exe tool install --global wix + dotnet.exe tool install --global wix --version 5.0.2 --verbosity diag - wix.exe extension add WixToolset.UI.wixext --global - - nuget.exe install WixToolset.Heat -NonInteractive - Get-ChildItem -Path .\WixToolset.Heat* -Recurse | - Where-Object { $_.FullName.EndsWith('x64\heat.exe') } | - Select-Object -ExpandProperty DirectoryName | - Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + wix.exe extension add WixToolset.UI.wixext/5.0.2 --global + wix.exe extension list --global - name: Generate version property id: version @@ -42,7 +37,7 @@ jobs: echo "version=$version" >> $env:GITHUB_OUTPUT - name: Run tests - run: dotnet.exe test .\src\PSDataProtection.sln + run: dotnet.exe test .\src\PSDataProtection.sln --configuration Release --runtime win-x64 - name: Clean solution run: dotnet.exe clean .\src\PSDataProtection.sln --configuration Release @@ -60,45 +55,22 @@ jobs: Update-MarkdownHelp ./docs -UpdateInputOutput -Force -ErrorAction Stop New-ExternalHelp ./docs -OutputPath ./publish -ErrorAction Stop - - name: Harvest installer - run: | - heat.exe ` - dir ` - .\publish ` - -nologo ` - -cg ProductComponents ` - -dr INSTALLDIR ` - -var var.ProductSource ` - -g1 ` - -ag ` - -ke ` - -srd ` - -sfrag ` - -sreg ` - -o Fragment.wxs - - name: Build installer run: | wix.exe ` build ` -arch x64 ` - -src Fragment.wxs src\Product.wxs ` - -d ProductSource=publish ` + -src src\Product.wxs ` + -d ProductSource="$(Resolve-Path ./publish)" ` -d ProductVersion="${{ steps.version.outputs.version }}" ` -ext WixToolset.UI.wixext ` -out ps-data-protection.msi - - name: Update installer - run: | - $path = Resolve-Path 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\msiinfo.exe' -ErrorAction Stop - - & $path ps-data-protection.msi -t "PowerShell Data Protection Module" -o "PSDataProtection v${{ steps.version.outputs.version }}" - - name: Validate installer run: wix.exe msi validate ps-data-protection.msi - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ps-data-protection path: | @@ -128,6 +100,7 @@ jobs: - name: Publish release if: github.ref_type == 'tag' - uses: ncipollo/release-action@v1 - with: - artifacts: ps-data-protection.msi + 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 + 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 0f3a254..e2b1639 100644 --- a/src/PSDataProtection/PSDataProtection.csproj +++ b/src/PSDataProtection/PSDataProtection.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/PSDataProtection/ReadDataProtectionSecretCommand.cs b/src/PSDataProtection/ReadDataProtectionSecretCommand.cs index 3d6ca35..a69bc67 100644 --- a/src/PSDataProtection/ReadDataProtectionSecretCommand.cs +++ b/src/PSDataProtection/ReadDataProtectionSecretCommand.cs @@ -6,8 +6,8 @@ namespace PSDataProtection; using System.Security.Cryptography; [Cmdlet(VerbsCommunications.Read, "DataProtectionSecret", DefaultParameterSetName = StringParameterSetName)] -[OutputType(typeof(string), ParameterSetName = new[] { StringParameterSetName })] -[OutputType(typeof(SecureString), ParameterSetName = new[] { SecureStringParameterSetName })] +[OutputType(typeof(string), ParameterSetName = [StringParameterSetName])] +[OutputType(typeof(SecureString), ParameterSetName = [SecureStringParameterSetName])] public class ReadDataProtectionSecretCommand : PSCmdlet { private readonly System.Text.UTF8Encoding encoding = new(); diff --git a/src/Product.wxs b/src/Product.wxs index 1388778..07c98cd 100644 --- a/src/Product.wxs +++ b/src/Product.wxs @@ -5,7 +5,7 @@ Version="$(var.ProductVersion)" Manufacturer="Joseph L. Casale" UpgradeCode="12d8a258-6fad-4f0e-9f1d-6062ded1e8e9"> - + @@ -40,5 +40,9 @@ + + + + \ No newline at end of file diff --git a/src/Tests/IntegrationTests.cs b/src/Tests/IntegrationTests.cs index 8d9c034..e1b1d82 100644 --- a/src/Tests/IntegrationTests.cs +++ b/src/Tests/IntegrationTests.cs @@ -1,7 +1,6 @@ namespace Tests; using System; -using System.Collections.Generic; using System.Management.Automation; using System.Management.Automation.Runspaces; using System.Security; @@ -31,11 +30,11 @@ public IntegrationTests() this.powerShell.Runspace = this.runSpace; } - public static IEnumerable NewDataProtectionSecretArguments() + public static TheoryData NewDataProtectionSecretArguments() => new() { - yield return new object[] { Guid.NewGuid().ToString(), DataProtectionScope.CurrentUser }; - yield return new object[] { Guid.NewGuid().ToString(), DataProtectionScope.LocalMachine }; - } + { Guid.NewGuid().ToString(), DataProtectionScope.CurrentUser }, + { Guid.NewGuid().ToString(), DataProtectionScope.LocalMachine } + }; [Theory] [MemberData(nameof(NewDataProtectionSecretArguments))] diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index e6a8be6..d3cbffb 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -9,11 +9,11 @@ - + - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all