forked from abpframework/abp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush_packages.ps1
44 lines (36 loc) · 1.21 KB
/
push_packages.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
. ".\common.ps1"
$apiKey = $args[0]
# Get the version
[xml]$commonPropsXml = Get-Content (Join-Path $rootFolder "common.props")
$version = $commonPropsXml.Project.PropertyGroup.Version
# Publish all packages
$i = 0
$errorCount = 0
$totalProjectsCount = $projects.length
$nugetUrl = "https://api.nuget.org/v3/index.json"
Set-Location $packFolder
foreach($project in $projects) {
$i += 1
$projectFolder = Join-Path $rootFolder $project
$projectName = ($project -split '/')[-1]
$nugetPackageName = $projectName + "." + $version + ".nupkg"
$nugetPackageExists = Test-Path $nugetPackageName -PathType leaf
Write-Info "[$i / $totalProjectsCount] - Pushing: $nugetPackageName"
if ($nugetPackageExists)
{
dotnet nuget push $nugetPackageName --skip-duplicate -s $nugetUrl --api-key "$apiKey"
#Write-Host ("Deleting package from local: " + $nugetPackageName)
#Remove-Item $nugetPackageName -Force
}
else
{
Write-Host ("********** ERROR PACKAGE NOT FOUND: " + $nugetPackageName) -ForegroundColor red
$errorCount += 1
#Exit
}
Write-Host "--------------------------------------------------------------`r`n"
}
if ($errorCount > 0)
{
Write-Host ("******* $errorCount error(s) occured *******") -ForegroundColor red
}