forked from StefanMaron/GenerateBcNuGet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenerateIndirectPackage.ps1
24 lines (19 loc) · 1.35 KB
/
GenerateIndirectPackage.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
Write-Host "Generate Indirect NuGet Package"
. (Join-Path $PSScriptRoot "HelperFunctions.ps1")
$appsFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([guid]::NewGuid().ToString())
$apps = @(Copy-AppFilesToFolder -appFiles @("$env:apps".Split(',')) -folder $appsFolder)
$nuGetServerUrl, $githubRepository = GetNuGetServerUrlAndRepository -nuGetServerUrl $env:nuGetServerUrl
$nuGetToken = $env:nuGetToken
foreach($appFile in $apps) {
$appJson = Get-AppJsonFromAppFile -appFile $appFile
# Test whether a NuGet package exists for this app?
$bcContainerHelperConfig.TrustedNuGetFeeds = @(
[PSCustomObject]@{ "url" = $nuGetServerUrl; "token" = $nuGetToken; "Patterns" = @("*.runtime.$($appJson.id)") }
)
$package = Get-BcNuGetPackage -packageName "runtime.$($appJson.id)" -version $appJson.version -select Exact
if (-not $package) {
# If just one of the apps doesn't exist as a nuGet package, we need to create a new indirect nuGet package and build all runtime versions of the nuGet
$package = New-BcNuGetPackage -appfile $appFile -githubRepository $githubRepository -isIndirectPackage -packageId "{publisher}.{name}.runtime.{id}" -runtimeDependencyId '{publisher}.{name}.runtime-{version}'
Push-BcNuGetPackage -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -bcNuGetPackage $package
}
}