-
Notifications
You must be signed in to change notification settings - Fork 56
/
publish.ps1
85 lines (62 loc) · 2.82 KB
/
publish.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# builds/publishes projects and creates NuGet packages
#
# usage: ./publish [-nobuild]
# -nobuild: does NOT build TypeGen.Core - useful for build servers so that TypeGen.Core is not built twice
if (-not $args -contains "-nobuild")
{
# build TypeGen.Core
dotnet clean .\src\TypeGen\TypeGen.Core
dotnet restore .\src\TypeGen\TypeGen.Core
dotnet build .\src\TypeGen\TypeGen.Core -f netstandard2.0 -c Release
dotnet build .\src\TypeGen\TypeGen.Core -f net8.0 -c Release
}
# publish TypeGen Cli
dotnet clean .\src\TypeGen\TypeGen.Cli
dotnet restore .\src\TypeGen\TypeGen.Cli
dotnet publish .\src\TypeGen\TypeGen.Cli -c Release -f net8.0
# create TypeGen NuGet package
#tools
if (test-path nuget\tools)
{
rm -Recurse -Force nuget\tools
}
new-item -Force -Path nuget\tools -ItemType Directory
$binFolder = if (test-path "src\TypeGen\TypeGen.Cli\bin\Any CPU\Release\net8.0\publish") {"bin\Any CPU"} else {"bin"}
copy -Recurse "src\TypeGen\TypeGen.Cli\$($binFolder)\Release\net8.0\publish\*" nuget\tools
mv nuget\tools\TypeGen.Cli.exe nuget\tools\TypeGen.exe
#lib
if (test-path nuget\lib)
{
rm -Recurse -Force nuget\lib
}
#netstandard2.0
new-item -Force -Path nuget\lib\netstandard2.0 -ItemType Directory
$binFolder = if (test-path "src\TypeGen\TypeGen.Core\bin\Any CPU\Release\netstandard2.0") {"bin\Any CPU"} else {"bin"}
copy "src\TypeGen\TypeGen.Core\$($binFolder)\Release\netstandard2.0\TypeGen.Core.dll" nuget\lib\netstandard2.0
copy "src\TypeGen\TypeGen.Core\$($binFolder)\Release\netstandard2.0\TypeGen.Core.xml" nuget\lib\netstandard2.0
#net8.0
new-item -Force -Path nuget\lib\net8.0 -ItemType Directory
$binFolder = if (test-path "src\TypeGen\TypeGen.Core\bin\Any CPU\Release\net8.0") {"bin\Any CPU"} else {"bin"}
copy "src\TypeGen\TypeGen.Core\$($binFolder)\Release\net8.0\TypeGen.Core.dll" nuget\lib\net8.0
copy "src\TypeGen\TypeGen.Core\$($binFolder)\Release\net8.0\TypeGen.Core.xml" nuget\lib\net8.0
nuget pack nuget\TypeGen.nuspec
# create dotnet-typegen NuGet package
if (test-path nuget-dotnetcli\tools)
{
rm -Recurse -Force nuget-dotnetcli\tools
}
new-item -Force -Path nuget-dotnetcli\tools\net8.0\any -ItemType Directory
$binFolder = if (test-path "src\TypeGen\TypeGen.Cli\bin\Any CPU\Release\net8.0\publish") {"bin\Any CPU"} else {"bin"}
copy -Recurse "src\TypeGen\TypeGen.Cli\$($binFolder)\Release\net8.0\publish\*" nuget-dotnetcli\tools\net8.0\any
New-Item nuget-dotnetcli\tools\net8.0\any\DotnetToolSettings.xml
set-content nuget-dotnetcli\tools\net8.0\any\DotnetToolSettings.xml '<?xml version="1.0" encoding="utf-8"?>
<DotNetCliTool Version="1">
<Commands>
<Command Name="dotnet-typegen" EntryPoint="TypeGen.Cli.dll" Runner="dotnet" />
</Commands>
</DotNetCliTool>'
nuget pack nuget-dotnetcli\dotnet-typegen.nuspec
# cleanup
rm -Recurse -Force nuget\tools
rm -Recurse -Force nuget\lib
rm -Recurse -Force nuget-dotnetcli\tools