From 71842f1e1b872f22b1a7712fc9df1e16d1594753 Mon Sep 17 00:00:00 2001 From: James Garriss <52328727+james-garriss@users.noreply.github.com> Date: Tue, 24 Dec 2024 15:29:32 -0500 Subject: [PATCH] add root folder name --- .github/workflows/build_sign_release.yaml | 3 ++- Testing/workflow/Build-SignRelease.Tests.ps1 | 5 +++-- Testing/workflow/Install-AzureSignTool.Tests.ps1 | 2 +- utils/workflow/Build-SignRelease.ps1 | 13 +++++++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_sign_release.yaml b/.github/workflows/build_sign_release.yaml index b86c4e856..29b7e796c 100644 --- a/.github/workflows/build_sign_release.yaml +++ b/.github/workflows/build_sign_release.yaml @@ -75,7 +75,8 @@ jobs: New-ModuleSignature ` -AzureKeyVaultUrl ${{ steps.key-vault-info.outputs.KeyVaultUrl }} ` -CertificateName ${{ steps.key-vault-info.outputs.KeyVaultCertificateName }} ` - -ReleaseVersion ${{ inputs.version }} + -ReleaseVersion ${{ inputs.version }} ` + -RootFolderName "root" - name: Create Release uses: softprops/action-gh-release@v1 id: create-release diff --git a/Testing/workflow/Build-SignRelease.Tests.ps1 b/Testing/workflow/Build-SignRelease.Tests.ps1 index f72a8b592..8986ea687 100644 --- a/Testing/workflow/Build-SignRelease.Tests.ps1 +++ b/Testing/workflow/Build-SignRelease.Tests.ps1 @@ -9,11 +9,12 @@ Describe "Sign Module Check" { $ScriptPath = Join-Path -Path $PSScriptRoot -ChildPath '../../utils/workflow/Build-SignRelease.ps1' -Resolve # Source the function . $ScriptPath - + $RootFolderName = Join-Path -Path $PSScriptRoot -Childpath '../..' New-ModuleSignature ` -AzureKeyVaultUrl "https://www.cisa.gov" ` -CertificateName "certificate name" ` - -ReleaseVersion "0.0.1" + -ReleaseVersion "0.0.1" ` + -RootFolderName $RootFolderName } } \ No newline at end of file diff --git a/Testing/workflow/Install-AzureSignTool.Tests.ps1 b/Testing/workflow/Install-AzureSignTool.Tests.ps1 index 1a2c9ad1e..7fa6a378a 100644 --- a/Testing/workflow/Install-AzureSignTool.Tests.ps1 +++ b/Testing/workflow/Install-AzureSignTool.Tests.ps1 @@ -1,7 +1,7 @@ # The purpose of this test is to verify that Azure Sign Tool is working. BeforeDiscovery { - $ScriptPath = Join-Path -Path $PSScriptRoot -ChildPath '../../utils/workflow/Install-AzureSignTool.ps1.ps1' -Resolve + $ScriptPath = Join-Path -Path $PSScriptRoot -ChildPath '../../utils/workflow/Install-AzureSignTool.ps1' -Resolve # Source the function . $ScriptPath Install-AzureSignTool diff --git a/utils/workflow/Build-SignRelease.ps1 b/utils/workflow/Build-SignRelease.ps1 index 9ce886b33..04d195bbd 100644 --- a/utils/workflow/Build-SignRelease.ps1 +++ b/utils/workflow/Build-SignRelease.ps1 @@ -8,6 +8,8 @@ function New-ModuleSignature { The name of the certificate stored in the KeyVault. .PARAMETER $ReleaseVersion The version number of the release (e.g., 1.5.1). + .PARAMETER $RootFolderName + The name of the root folder. #> [CmdletBinding()] param( @@ -19,7 +21,10 @@ function New-ModuleSignature { $CertificateName, [Parameter(Mandatory = $true)] [string] - $ReleaseVersion + $ReleaseVersion, + [Parameter(Mandatory = $true)] + [string] + $RootFolderName ) Write-Warning "Signing the module with AzureSignTool..." @@ -29,10 +34,10 @@ function New-ModuleSignature { . $PublishPath # Remove non-release files (required for non-Windows machines) - Remove-Item -Recurse -Force repo -Include .git* + Remove-Item -Recurse -Force $RootFolderName -Include .git* Write-Warning "Creating an array of the files to sign..." $ArrayOfFilePaths = New-ArrayOfFilePaths ` - -ModuleDestinationPath repo + -ModuleDestinationPath $RootFolderName Write-Warning "Creating a file with a list of the files to sign..." $FileListFileName = New-FileList ` @@ -43,6 +48,6 @@ function New-ModuleSignature { -AzureKeyVaultUrl $AzureKeyVaultUrl ` -CertificateName $CertificateName ` -FileList $FileListFileName - Move-Item -Path repo -Destination "ScubaGear-$ReleaseVersion" -Force + Move-Item -Path $RootFolderName -Destination "ScubaGear-$ReleaseVersion" -Force Compress-Archive -Path "ScubaGear-$ReleaseVersion" -DestinationPath "ScubaGear-$ReleaseVersion.zip" }