-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathBuild-pipeline.ps1
27 lines (24 loc) · 1.01 KB
/
Build-pipeline.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
param(
$ApiKey
)
$file = "$PSScriptRoot\XpandPwsh\XpandPwsh.psd1"
$data = Get-Content $file -Raw
$onlineVersion = (Find-Module XpandPwsh -Repository PSGallery -ErrorAction Continue).Version.ToString()
$manifest = Invoke-Expression $data
"manifest.ModuleVersion=$($manifest.ModuleVersion)"
"onlineVersion=$onlineVersion"
if ($manifest.ModuleVersion -ne $onlineVersion) {
$binFolder="$PSScriptRoot\XpandPwsh\Cmdlets\bin"
if (!(Test-Path $binFolder)){
New-Item $binFolder -ItemType Directory
}
$publish=dotnet build "$PSScriptRoot\XpandPwsh\Cmdlets\src\XpandPwsh.CmdLets.sln" --source https://api.nuget.org/v3/index.json
if ($LASTEXITCODE){
throw "Fail to publish $assemblyName`r`n`r`n$publish"
}
$publish
$ErrorActionPreference="Stop"
Import-Module $PSScriptRoot\XpandPwsh\XpandPwsh.psm1 -Verbose
$m=Get-Module XpandPwsh
Publish-Module -Path (Get-Item $m.Path).DirectoryName -verbose -NugetApiKey $ApiKey -SkipAutomaticTags -Repository PSGallery
}