1
1
function Use-AzureSignTool {
2
2
<#
3
3
. SYNOPSIS
4
- AzureSignTool is a utility for signing code that is used to secure ScubaGear .
4
+ AzureSignTool is a utility for signing code.
5
5
https://github.com/vcsjones/AzureSignTool
6
- Throws an error if there was an error signing the files.
6
+ Throws an error, if there was an error signing the files.
7
7
#>
8
8
param (
9
9
[Parameter (Mandatory = $true )]
10
10
[ValidateScript ({ [uri ]::IsWellFormedUriString($_ , ' Absolute' ) -and ([uri ] $_ ).Scheme -in ' https' })]
11
11
[System.Uri ]
12
12
$AzureKeyVaultUrl ,
13
+
13
14
[Parameter (Mandatory = $true )]
14
15
[ValidateNotNullOrEmpty ()]
15
16
[string ]
16
17
$CertificateName ,
18
+
17
19
[Parameter (Mandatory = $false )]
18
20
[ValidateScript ({ [uri ]::IsWellFormedUriString($_ , ' Absolute' ) -and ([uri ] $_ ).Scheme -in ' http' , ' https' })]
19
21
$TimeStampServer = ' http://timestamp.digicert.com' ,
22
+
20
23
[Parameter (Mandatory = $true )]
21
24
[ValidateScript ({ Test-Path - Path $_ - PathType Leaf })]
22
25
$FileList
@@ -44,7 +47,9 @@ function Use-AzureSignTool {
44
47
Write-Error = $ErrorMessage
45
48
throw $ErrorMessage
46
49
}
50
+
47
51
$ToolPath = (Get-Command AzureSignTool).Path
52
+
48
53
Write-Warning " The path to AzureSignTool is $ToolPath "
49
54
# & is the call operator that executes a command, script, or function.
50
55
$Results = & $ToolPath $SignArguments
@@ -55,11 +60,11 @@ function Use-AzureSignTool {
55
60
$SuccessPattern = ' Failed operations: 0'
56
61
$FoundNoFailures = $Results | Select-String - Pattern $SuccessPattern - Quiet
57
62
if ($FoundNoFailures -eq $true ) {
58
- Write-Warning " Signed the filelist without errors."
63
+ Write-Warning " Signed the file list without errors."
59
64
}
60
65
else {
61
- $ErrorMessage = " Failed to sign the filelist without errors."
62
- Write-Error = $ErrorMessage
66
+ $ErrorMessage = " Failed to sign the file list without errors."
67
+ Write-Error $ErrorMessage
63
68
throw $ErrorMessage
64
69
}
65
70
}
@@ -81,10 +86,14 @@ function New-ArrayOfFilePaths {
81
86
$ArrayOfFilePaths = @ ()
82
87
$ArrayOfFilePaths = Get-ChildItem - Recurse - Path $ModuleDestinationPath - Include $FileExtensions
83
88
84
- # Write-Warning "Verifying array of file paths..."
85
- # ForEach ($FilePath in $ArrayOfFilePaths) {
86
- # Write-Warning ">>> File path is $FilePath"
87
- # }
89
+ #
90
+ # Files to sign. Hardcoded as the number of files to sign is 1 to few.
91
+ # Since we don't need to sign every PowerShell file.
92
+ #
93
+ $FilesToSign = @ (" Install-GearConnect.ps1" )
94
+
95
+ # Filter files to the scripts we want to sign
96
+ $ArrayOfFilePaths = $ArrayOfFilePaths | Where-Object { $FilesToSign -contains $_.name }
88
97
89
98
if ($ArrayOfFilePaths.Length -gt 0 ) {
90
99
Write-Warning " Found $ ( $ArrayOfFilePaths.Count ) files to sign"
@@ -127,7 +136,7 @@ function New-FileList {
127
136
return $FileListFileName
128
137
}
129
138
130
- function New-ModuleSignature {
139
+ function New-ScubaReleaseAsset {
131
140
<#
132
141
. SYNOPSIS
133
142
Sign the module.
@@ -148,12 +157,15 @@ function New-ModuleSignature {
148
157
[Parameter (Mandatory = $true )]
149
158
[string ]
150
159
$AzureKeyVaultUrl ,
160
+
151
161
[Parameter (Mandatory = $true )]
152
162
[string ]
153
163
$CertificateName ,
164
+
154
165
[Parameter (Mandatory = $true )]
155
166
[string ]
156
167
$ReleaseVersion ,
168
+
157
169
[Parameter (Mandatory = $true )]
158
170
[string ]
159
171
$RootFolderName
@@ -186,7 +198,18 @@ function New-ModuleSignature {
186
198
- AzureKeyVaultUrl $AzureKeyVaultUrl `
187
199
- CertificateName $CertificateName `
188
200
- FileList $FileListFileName
189
- $ReleaseName = " ScubaConnect"
190
- Move-Item - Path $RootFolderName - Destination " $ReleaseName -$ReleaseVersion " - Force
191
- Compress-Archive - Path " $ReleaseName -$ReleaseVersion " - DestinationPath " $ReleaseName -$ReleaseVersion .zip"
201
+
202
+ # create the M365 GearConnect zip asset
203
+ $GearConnectAsset = " GearConnect-$ReleaseVersion "
204
+ Move-Item - Path " $RootFolderName /m365" - Destination $GearConnectAsset - Force
205
+ Compress-Archive - Path $GearConnectAsset - DestinationPath " $GearConnectAsset .zip"
206
+
207
+ # Commented out block below until GogglesConnect is release ready
208
+ # Remember to also add: GogglesConnect-${{ inputs.version }}.zip
209
+ # under `files` in the release action
210
+
211
+ # create the GWS GogglesConnect zip asset
212
+ # $GogglesConnectAsset = "GogglesConnect-$ReleaseVersion"
213
+ # Move-Item -Path "$RootFolderName/gws" -Destination $GogglesConnectAsset -Force
214
+ # Compress-Archive -Path $GogglesConnectAsset -DestinationPath "$GogglesConnectAsset.zip"
192
215
}
0 commit comments