3 changed files with 233 additions and 1 deletions
@ -0,0 +1,131 @@ |
|||
$projects = ( |
|||
|
|||
"src/Lsw.Abp.AntDesignUI", |
|||
|
|||
"modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme", |
|||
"modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme", |
|||
"modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme", |
|||
|
|||
"modules/FeatureManagement/Lsw.Abp.FeatureManagement.Blazor.AntDesignUI", |
|||
"modules/FeatureManagement/Lsw.Abp.FeatureManagement.Blazor.Server.AntDesignUI", |
|||
"modules/FeatureManagement/Lsw.Abp.FeatureManagement.Blazor.WebAssembly.AntDesignUI", |
|||
|
|||
"modules/IdentityManagement/Lsw.Abp.IdentityManagement.Blazor.AntDesignUI", |
|||
"modules/IdentityManagement/Lsw.Abp.IdentityManagement.Blazor.Server.AntDesignUI", |
|||
"modules/IdentityManagement/Lsw.Abp.IdentityManagement.Blazor.WebAssembly.AntDesignUI", |
|||
|
|||
"modules/PermissionManagement/Lsw.Abp.PermissionManagement.Blazor.AntDesignUI", |
|||
"modules/PermissionManagement/Lsw.Abp.PermissionManagement.Blazor.Server.AntDesignUI", |
|||
"modules/PermissionManagement/Lsw.Abp.PermissionManagement.Blazor.WebAssembly.AntDesignUI", |
|||
|
|||
"modules/SettingManagement/Lsw.Abp.SettingManagement.Blazor.AntDesignUI", |
|||
"modules/SettingManagement/Lsw.Abp.SettingManagement.Blazor.Server.AntDesignUI", |
|||
"modules/SettingManagement/Lsw.Abp.SettingManagement.Blazor.WebAssembly.AntDesignUI", |
|||
|
|||
"modules/TenantManagement/Lsw.Abp.TenantManagement.Blazor.AntDesignUI", |
|||
"modules/TenantManagement/Lsw.Abp.TenantManagement.Blazor.Server.AntDesignUI", |
|||
"modules/TenantManagement/Lsw.Abp.TenantManagement.Blazor.WebAssembly.AntDesignUI" |
|||
|
|||
) |
|||
|
|||
$packFolder = (Get-Item -Path "./" -Verbose).FullName |
|||
$rootFolder = Join-Path $packFolder "../" |
|||
|
|||
function Write-Info |
|||
{ |
|||
param( |
|||
[Parameter(Mandatory = $true)] |
|||
[string] |
|||
$text |
|||
) |
|||
|
|||
Write-Host $text -ForegroundColor Black -BackgroundColor Green |
|||
|
|||
try |
|||
{ |
|||
$host.UI.RawUI.WindowTitle = $text |
|||
} |
|||
catch |
|||
{ |
|||
#Changing window title is not suppoerted! |
|||
} |
|||
} |
|||
|
|||
function Write-Error |
|||
{ |
|||
param( |
|||
[Parameter(Mandatory = $true)] |
|||
[string] |
|||
$text |
|||
) |
|||
|
|||
Write-Host $text -ForegroundColor Red -BackgroundColor Black |
|||
} |
|||
|
|||
function Seperator |
|||
{ |
|||
Write-Host ("_" * 100) -ForegroundColor gray |
|||
} |
|||
|
|||
function Get-Current-Version { |
|||
$commonPropsFilePath = resolve-path "../common.props" |
|||
$commonPropsXmlCurrent = [xml](Get-Content $commonPropsFilePath ) |
|||
$currentVersion = $commonPropsXmlCurrent.Project.PropertyGroup.Version.Trim() |
|||
return $currentVersion |
|||
} |
|||
|
|||
function Get-Current-Branch { |
|||
return git branch --show-current |
|||
} |
|||
|
|||
function Read-File { |
|||
param( |
|||
[Parameter(Mandatory = $true)] |
|||
[string] |
|||
$filePath |
|||
) |
|||
|
|||
$pathExists = Test-Path -Path $filePath -PathType Leaf |
|||
if ($pathExists) |
|||
{ |
|||
return Get-Content $filePath |
|||
} |
|||
else{ |
|||
Write-Error "$filePath path does not exist!" |
|||
} |
|||
} |
|||
|
|||
# Delete old packages |
|||
del *.nupkg |
|||
|
|||
# Create all packages |
|||
$i = 0 |
|||
$projectsCount = $projects.length |
|||
Write-Info "Running dotnet pack on $projectsCount projects..." |
|||
|
|||
foreach($project in $projects) { |
|||
$i += 1 |
|||
$projectFolder = Join-Path $rootFolder $project |
|||
$projectName = ($project -split '/')[-1] |
|||
|
|||
# Create nuget pack |
|||
Write-Info "[$i / $projectsCount] - Packing project: $projectName" |
|||
Set-Location $projectFolder |
|||
dotnet clean |
|||
dotnet pack -c Release |
|||
|
|||
if (-Not $?) { |
|||
Write-Error "Packaging failed for the project: $projectName" |
|||
exit $LASTEXITCODE |
|||
} |
|||
|
|||
# Move nuget package |
|||
$projectName = $project.Substring($project.LastIndexOf("/") + 1) |
|||
$projectPackPath = Join-Path $projectFolder ("/bin/Release/" + $projectName + ".*.nupkg") |
|||
Move-Item -Force $projectPackPath $packFolder |
|||
|
|||
Seperator |
|||
} |
|||
|
|||
# Go back to the pack folder |
|||
Set-Location $packFolder |
|||
@ -0,0 +1,101 @@ |
|||
$projects = ( |
|||
|
|||
"src/Lsw.Abp.AntDesignUI", |
|||
|
|||
"modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme", |
|||
"modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme", |
|||
"modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme", |
|||
|
|||
"modules/FeatureManagement/Lsw.Abp.FeatureManagement.Blazor.AntDesignUI", |
|||
"modules/FeatureManagement/Lsw.Abp.FeatureManagement.Blazor.Server.AntDesignUI", |
|||
"modules/FeatureManagement/Lsw.Abp.FeatureManagement.Blazor.WebAssembly.AntDesignUI", |
|||
|
|||
"modules/IdentityManagement/Lsw.Abp.IdentityManagement.Blazor.AntDesignUI", |
|||
"modules/IdentityManagement/Lsw.Abp.IdentityManagement.Blazor.Server.AntDesignUI", |
|||
"modules/IdentityManagement/Lsw.Abp.IdentityManagement.Blazor.WebAssembly.AntDesignUI", |
|||
|
|||
"modules/PermissionManagement/Lsw.Abp.PermissionManagement.Blazor.AntDesignUI", |
|||
"modules/PermissionManagement/Lsw.Abp.PermissionManagement.Blazor.Server.AntDesignUI", |
|||
"modules/PermissionManagement/Lsw.Abp.PermissionManagement.Blazor.WebAssembly.AntDesignUI", |
|||
|
|||
"modules/SettingManagement/Lsw.Abp.SettingManagement.Blazor.AntDesignUI", |
|||
"modules/SettingManagement/Lsw.Abp.SettingManagement.Blazor.Server.AntDesignUI", |
|||
"modules/SettingManagement/Lsw.Abp.SettingManagement.Blazor.WebAssembly.AntDesignUI", |
|||
|
|||
"modules/TenantManagement/Lsw.Abp.TenantManagement.Blazor.AntDesignUI", |
|||
"modules/TenantManagement/Lsw.Abp.TenantManagement.Blazor.Server.AntDesignUI", |
|||
"modules/TenantManagement/Lsw.Abp.TenantManagement.Blazor.WebAssembly.AntDesignUI" |
|||
|
|||
) |
|||
|
|||
$packFolder = (Get-Item -Path "./" -Verbose).FullName |
|||
$rootFolder = Join-Path $packFolder "../" |
|||
|
|||
$apiKey = $args[0] |
|||
|
|||
# Get the version |
|||
[xml]$commonPropsXml = Get-Content (Join-Path $rootFolder "common.props") |
|||
$version = $commonPropsXml.Project.PropertyGroup.Version |
|||
|
|||
|
|||
function Write-Info |
|||
{ |
|||
param( |
|||
[Parameter(Mandatory = $true)] |
|||
[string] |
|||
$text |
|||
) |
|||
|
|||
Write-Host $text -ForegroundColor Black -BackgroundColor Green |
|||
|
|||
try |
|||
{ |
|||
$host.UI.RawUI.WindowTitle = $text |
|||
} |
|||
catch |
|||
{ |
|||
#Changing window title is not suppoerted! |
|||
} |
|||
} |
|||
|
|||
function Seperator |
|||
{ |
|||
Write-Host ("_" * 100) -ForegroundColor gray |
|||
} |
|||
|
|||
# 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 |
|||
} |
|||
Loading…
Reference in new issue