-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpackage.ps1
49 lines (41 loc) · 1.61 KB
/
package.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
45
46
47
48
49
$CONFIGURATION = "Release"
$FRAMEWORK = "netstandard2.0"
$root = (split-path -parent $MyInvocation.MyCommand.Definition)
$packageRoot = "$root\nuget"
$versionFile = "$packageRoot\.version"
$artifactsPath = "$packageRoot\artifacts"
#Delete any existing artifacts
If (Test-Path $artifactsPath)
{
Remove-Item $artifactsPath\*.nupkg
}
$common = "$root\src\BaristaLabs.BaristaCore.Common\"
$extensions = "$root\src\BaristaLabs.BaristaCore.Extensions\"
$aspnetcorecommon = "$root\src\BaristaLabs.BaristaCore.AspNetCore.Common\"
dotnet build -c $CONFIGURATION -f $FRAMEWORK $common
dotnet build -c $CONFIGURATION -f $FRAMEWORK $extensions
dotnet build -c $CONFIGURATION -f $FRAMEWORK $aspnetcorecommon
$VERSION = (Get-Content $versionFile)
Write-Host "Setting .nuspec version tag to $VERSION"
$compiledNuspec = "$packageRoot\compiled.nuspec"
# Create new packages for any nuspec files that exist in this directory.
Foreach ($nuspec in $(Get-Item "$packageRoot\*.nuspec"))
{
$content = (Get-Content $nuspec)
$content = $content -replace '\$version\$',$VERSION
$content = $content -replace '\$configuration\$',$CONFIGURATION
$content = $content -replace '\$framework\$',$FRAMEWORK
$content = $content -replace '\$root\$',$root
$content | Out-File $compiledNuspec
& nuget pack $compiledNuspec -outputdirectory $artifactsPath
}
# Delete compiled temporary nuspec.
If (Test-Path $compiledNuspec)
{
Remove-Item $compiledNuspec
}
# Publish new packages for any nupkg files that exist in this directory.
Foreach ($nupkg in $(Get-Item $artifactsPath\*.nupkg))
{
& nuget push $nupkg -Source https://api.nuget.org/v3/index.json
}