Skip to content

Commit 0ff20a7

Browse files
authored
Update build\Sign-And-Publish.ps1
1 parent a51d54c commit 0ff20a7

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

build\Sign-And-Publish.ps1

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +0,0 @@
1-
param(
2-
[string]$ModulePath = (Resolve-Path '..'),
3-
[string]$GalleryApiKey
4-
)
5-
6-
if (-not $GalleryApiKey) {
7-
$GalleryApiKey = Read-Host -AsSecureString "Enter PSGallery API key"
8-
}
9-
10-
Write-Host "[*] Testing module manifest..."
11-
$manifest = Join-Path $ModulePath 'OffsetInspect.psd1'
12-
Test-ModuleManifest -Path $manifest | Out-Null
13-
14-
Write-Host "[*] Importing module for sanity check..."
15-
Import-Module $manifest -Force
16-
17-
Write-Host "[*] Running Pester tests..."
18-
Invoke-Pester -Path (Join-Path $ModulePath 'tests') -Output Summary -EnableExit
19-
20-
Write-Host "[*] Locating code-signing certificate..."
21-
$cert = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert | Select-Object -First 1
22-
if (-not $cert) {
23-
throw "No code-signing certificate found in Cert:\CurrentUser\My. Create or import one first."
24-
}
25-
26-
$filesToSign = @(
27-
'OffsetInspect.psm1',
28-
'OffsetInspect.ps1'
29-
) | ForEach-Object { Join-Path $ModulePath $_ }
30-
31-
foreach ($file in $filesToSign) {
32-
Write-Host "[*] Signing $file"
33-
Set-AuthenticodeSignature -FilePath $file -Certificate $cert | Out-String | Write-Host
34-
}
35-
36-
Write-Host "[*] Publishing OffsetInspect to PSGallery..."
37-
Publish-Module -Path $ModulePath `
38-
-Repository PSGallery `
39-
-NuGetApiKey $GalleryApiKey `
40-
-Verbose
41-
42-
Write-Host "[+] Done."

0 commit comments

Comments
 (0)