forked from cdhunt/SecretManagement.1Password
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
46 lines (37 loc) · 1.12 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
[CmdletBinding()]
param (
[Parameter()]
[switch]
$Test,
[Parameter()]
[switch]
$Package,
[Parameter()]
[switch]
$Publish
)
Push-Location $PSScriptRoot
if ($Test) {
Invoke-Pester tests
}
if ($Package) {
$outDir = Join-Path 'release' 'SecretManagement.1Password'
Remove-Item release -Recurse -Force -ErrorAction SilentlyContinue | Out-Null
@(
'SecretManagement.1Password.Extension'
'SecretManagement.1Password.psd1'
'LICENSE.txt'
'README.md'
) | ForEach-Object {
Copy-Item -Path $_ -Destination (Join-Path $outDir $_) -Force -Recurse
}
}
if ($Publish) {
Write-Host -ForegroundColor Green "Publishing module... here are the details:"
$moduleData = Import-Module -Force ./release/SecretManagement.1Password -PassThru
Write-Host "Version: $($moduleData.Version)"
Write-Host "Prerelease: $($moduleData.PrivateData.PSData.Prerelease)"
Write-Host -ForegroundColor Green "Here we go..."
Publish-Module -Path ./release/SecretManagement.1Password -NuGetApiKey (Get-Secret -Name PSGalleryApiKey -AsPlainText)
}
Pop-Location