5 changed files with 231 additions and 1 deletions
			
			
		| @ -0,0 +1,18 @@ | ||||
| $rootFolder = (Get-Item -Path "./" -Verbose).FullName | ||||
| 
 | ||||
| $solutionPaths = @( | ||||
| 		"../" | ||||
| 	) | ||||
| 
 | ||||
| foreach ($solutionPath in $solutionPaths) {     | ||||
|     $solutionAbsPath = (Join-Path $rootFolder $solutionPath) | ||||
|     Set-Location $solutionAbsPath | ||||
|     dotnet build --configuration Release | ||||
|     if (-Not $?) { | ||||
|         Write-Host ("Build failed for the solution: " + $solutionPath) | ||||
|         Set-Location $rootFolder | ||||
|         exit $LASTEXITCODE | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| Set-Location $rootFolder | ||||
| @ -0,0 +1,126 @@ | ||||
| # Nuget包文件夹 | ||||
| $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!" | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| # 解决方案列表 | ||||
| $solutions = ( | ||||
|     # Sanhe.Abp.Framework | ||||
|     "./" | ||||
| ) | ||||
| 
 | ||||
| # 项目列表 | ||||
| $projects = ( | ||||
|     # modules/common | ||||
|     "modules/common/Sanhe.Abp.EntityFrameworkCore", | ||||
|     "modules/common/Sanhe.Abp.ExceptionHandling", | ||||
|     "modules/common/Sanhe.Abp.ExceptionHandling.Emailing", | ||||
|     "modules/common/Sanhe.Abp.Features.LimitValidation", | ||||
|     "modules/common/Sanhe.Abp.Features.LimitValidation.Redis", | ||||
|     "modules/common/Sanhe.Abp.Features.LimitValidation.Redis.Client", | ||||
|     "modules/common/Sanhe.Abp.Hangfire.Dashboard", | ||||
|     "modules/common/Sanhe.Abp.Hangfire.Storage.PostgreSql", | ||||
|     "modules/common/Sanhe.Abp.IdGenerator", | ||||
|     "modules/common/Sanhe.Abp.Localization.Dynamic", | ||||
|     "modules/common/Sanhe.Abp.Notifications", | ||||
|     "modules/common/Sanhe.Abp.PinyinConverter", | ||||
|     "modules/common/Sanhe.Abp.PinyinConverter.ToolGoodWords", | ||||
|     "modules/common/Sanhe.Abp.RealTime", | ||||
|     "modules/common/Sanhe.Abp.Wrapper", | ||||
|          | ||||
|     # modules/elasticsearch | ||||
|     "modules/elasticsearch/Sanhe.Abp.Elasticsearch", | ||||
| 
 | ||||
|     # modules/identity | ||||
|     "modules/identity/Sanhe.Abp.Identity.Application", | ||||
|     "modules/identity/Sanhe.Abp.Identity.Application.Contracts", | ||||
|     "modules/identity/Sanhe.Abp.Identity.Domain", | ||||
|     "modules/identity/Sanhe.Abp.Identity.Domain.Shared", | ||||
|     "modules/identity/Sanhe.Abp.Identity.EntityFrameworkCore", | ||||
|     "modules/identity/Sanhe.Abp.Identity.HttpApi", | ||||
|     "modules/identity/Sanhe.Abp.Identity.HttpApi.Client", | ||||
| 
 | ||||
|     # modules/localization-management | ||||
|     "modules/localization-management/Sanhe.Abp.LocalizationManagement.Application", | ||||
|     "modules/localization-management/Sanhe.Abp.LocalizationManagement.Application.Contracts", | ||||
|     "modules/localization-management/Sanhe.Abp.LocalizationManagement.Domain", | ||||
|     "modules/localization-management/Sanhe.Abp.LocalizationManagement.Domain.Shared", | ||||
|     "modules/localization-management/Sanhe.Abp.LocalizationManagement.EntityFrameworkCore", | ||||
|     "modules/localization-management/Sanhe.Abp.LocalizationManagement.HttpApi", | ||||
| 
 | ||||
|     # modules/menu-management | ||||
|     "modules/menu-management/Sanhe.Abp.MenuManagement.Application", | ||||
|     "modules/menu-management/Sanhe.Abp.MenuManagement.Application.Contracts", | ||||
|     "modules/menu-management/Sanhe.Abp.MenuManagement.Domain", | ||||
|     "modules/menu-management/Sanhe.Abp.MenuManagement.Domain.Identity", | ||||
|     "modules/menu-management/Sanhe.Abp.MenuManagement.Domain.Shared", | ||||
|     "modules/menu-management/Sanhe.Abp.MenuManagement.EntityFrameworkCore", | ||||
|     "modules/menu-management/Sanhe.Abp.MenuManagement.HttpApi", | ||||
| 
 | ||||
|     # modules/mvc | ||||
|     "modules/mvc/Sanhe.Abp.AspNetCore.Mvc.Wrapper" | ||||
| ) | ||||
| @ -0,0 +1,43 @@ | ||||
| . ".\common.ps1" | ||||
| 
 | ||||
| # 重新构建所有解决方案 | ||||
| foreach($solution in $solutions) { | ||||
|     $solutionFolder = Join-Path $rootFolder $solution | ||||
|     Set-Location $solutionFolder | ||||
|     & dotnet restore | ||||
| } | ||||
| 
 | ||||
| # 删除旧的Nuget包 | ||||
| del *.nupkg | ||||
| 
 | ||||
| # 创建新的Nuget包 | ||||
| $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] | ||||
| 	 | ||||
|     # 创建Nuget包 | ||||
|     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 | ||||
|     } | ||||
|      | ||||
|     # 移动Nuget包 | ||||
|     $projectName = $project.Substring($project.LastIndexOf("/") + 1) | ||||
|     $projectPackPath = Join-Path $projectFolder ("/bin/Release/" + $projectName + ".*.nupkg") | ||||
|     Move-Item -Force $projectPackPath $packFolder | ||||
| 	 | ||||
| 	Seperator | ||||
| } | ||||
| 
 | ||||
| # 退回Nuget包文件夹 | ||||
| Set-Location $packFolder | ||||
| @ -0,0 +1,44 @@ | ||||
| . ".\common.ps1" | ||||
| 
 | ||||
| $apiKey = $args[0] | ||||
| 
 | ||||
| # »ñÈ¡°æ±¾ | ||||
| [xml]$commonPropsXml = Get-Content (Join-Path $rootFolder "common.props") | ||||
| $version = $commonPropsXml.Project.PropertyGroup.Version | ||||
| 
 | ||||
| # ·¢²¼ËùÓÐNuget°ü | ||||
| $i = 0 | ||||
| $errorCount = 0 | ||||
| $totalProjectsCount = $projects.length | ||||
| $nugetUrl = "http://nuget.sanhexinxi.com:80/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