Commit 772e86dd authored by gdlcf88's avatar gdlcf88

Add NuGet scripts.

parent 9b0ad4e6
# Paths
$packFolder = (Get-Item -Path "./" -Verbose).FullName
$rootFolder = Join-Path $packFolder "../"
# List of projects
$projects = (
"src/EasyAbp.CacheManagement.Application",
"src/EasyAbp.CacheManagement.Application.Contracts",
"src/EasyAbp.CacheManagement.Domain",
"src/EasyAbp.CacheManagement.Domain.Shared",
"src/EasyAbp.CacheManagement.EntityFrameworkCore",
"src/EasyAbp.CacheManagement.HttpApi",
"src/EasyAbp.CacheManagement.HttpApi.Client",
"src/EasyAbp.CacheManagement.MongoDB",
"src/EasyAbp.CacheManagement.Web",
"driver/EasyAbp.CacheManagement.StackExchangeRedis"
)
\ No newline at end of file
. ".\common.ps1"
# Rebuild solution
Set-Location $rootFolder
& dotnet restore
# Create all packages
foreach($project in $projects) {
$projectFolder = Join-Path $rootFolder $project
# Create nuget pack
Set-Location $projectFolder
Remove-Item -Recurse (Join-Path $projectFolder "bin/Release")
& dotnet build -c Release
& dotnet pack -c Release
if (-Not $?) {
Write-Host ("Packaging failed for the project: " + $projectFolder)
exit $LASTEXITCODE
}
# Copy nuget package
$projectName = $project.Substring($project.LastIndexOf("/") + 1)
$projectPackPath = Join-Path $projectFolder ("/bin/Release/" + $projectName + ".*.nupkg")
Move-Item $projectPackPath $packFolder
}
# Go back to the pack folder
Set-Location $packFolder
\ No newline at end of file
. ".\common.ps1"
# Get the version
[xml]$commonPropsXml = Get-Content (Join-Path $rootFolder "common.props")
$version = $commonPropsXml.Project.PropertyGroup.Version
# Publish all packages
foreach($project in $projects) {
$projectName = $project.Substring($project.LastIndexOf("/") + 1)
& dotnet nuget push ($projectName + "." + $version + ".nupkg") -s https://api.nuget.org/v3/index.json
}
# Go back to the pack folder
Set-Location $packFolder
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment