-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdotNetUpackPush.ps1
More file actions
54 lines (45 loc) · 1.83 KB
/
Copy pathdotNetUpackPush.ps1
File metadata and controls
54 lines (45 loc) · 1.83 KB
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
47
48
49
50
51
52
53
54
param(
[Parameter(Mandatory = $false)]
[String] $Feed = "tools"
)
$ErrorActionPreference = "Stop"
$ModuleRoot = Resolve-Path "$PSScriptRoot\..\.."
Import-Module "$ModuleRoot\..\Common\Common.psm1" -DisableNameChecking
Import-HspPsUpack
$ArtifactRoot = $env:PIPELINE_WORKSPACE
if (-not $ArtifactRoot) {
Write-Warning "The variable 'PIPELINE_WORKSPACE' is not defined. Exiting ..."
return
}
$ArtifactRoot = [IO.Path]::Combine($ArtifactRoot, 'output')
if (-not [IO.Directory]::Exists($ArtifactRoot)) {
Write-Warning "The directory '$ArtifactRoot' does not exist. Exiting ..."
return
}
$BuildVersion = Get-InputVariable "BUILD_VERSION" -Require
$BuildVersion = [Version]::Parse($BuildVersion)
$BuildVersion = "$($BuildVersion.Major).$($BuildVersion.Minor).$($BuildVersion.Build)"
Write-Host "Using '$BuildVersion' as build version."
$ProGet_BaseUrl = Get-InputVariable "PROGET_BASEURL" -Require
$ProGet_ApiKey = Get-InputVariable "PROGET_API_KEY" -Require
$ManifestPaths = Get-ChildItem $ArtifactRoot -Filter "upack.json" -Recurse | Select-Object -ExpandProperty FullName
if (-not $ManifestPaths) {
Write-Host "No UPack Manifests found in '$ArtifactRoot', exiting ..."
return
}
foreach ($ManifestPath in $ManifestPaths) {
$PackageFolder = [IO.Path]::GetDirectoryName($ManifestPath)
Write-Host "Creating UPack package from folder '$PackageFolder'"
Write-Host "Using Proget Feed: '$Feed'"
Write-Host "$ProGet_BaseUrl/upack/$Feed"
$Manifest = Get-Content -Path $ManifestPath -Raw | ConvertFrom-Json
Remove-Item $ManifestPath
Hsp.Ps.Upack\Publish-UPackPackage `
-FolderPath $PackageFolder `
-Name $Manifest.Name `
-Title $Manifest.Title `
-IconUrl $Manifest.IconUrl `
-Version $BuildVersion `
-FeedUri "$ProGet_BaseUrl/upack/$Feed" `
-ApiKey "$ProGet_ApiKey"
}