-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpakefile.ps1
More file actions
78 lines (61 loc) · 2.29 KB
/
pakefile.ps1
File metadata and controls
78 lines (61 loc) · 2.29 KB
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
$msbuild = "C:\Program Files\Microsoft Visual Studio\2022\Community\\MSBuild\Current\Bin\amd64\MSBuild.exe"
$msbuild = "C:\Program Files\Microsoft Visual Studio\2022\Preview\\MSBuild\Current\Bin\amd64\MSBuild.exe"
function Init {
# dotnet tool install -g nbgv
dotnet tool install --tool-path .tools nbgv
winget install --id Microsoft.NuGet
}
function Get-Version {
dotnet restore .\src\NanoDbProfiler.AspNetCore\NanoDbProfiler.AspNetCore.csproj --use-lock-file | Out-Null
# Define the path to the packages.lock.json file
$filePath = ".\src\NanoDbProfiler.AspNetCore\packages.lock.json"
# Check if the file exists
if (Test-Path $filePath) {
# Read and parse the JSON content
$jsonContent = Get-Content -Path $filePath -Raw | ConvertFrom-Json
# Navigate to the net8.0 dependencies and find Microsoft.EntityFrameworkCore.Relational
$dependency = $jsonContent.dependencies."net8.0"."Microsoft.EntityFrameworkCore.Relational"
if ($dependency -ne $null) {
# Extract and display the resolved version
$version = $dependency.resolved
Write-Output $version
}
else {
Write-Error "Microsoft.EntityFrameworkCore.Relational dependency not found in packages.lock.json"
}
}
else {
Write-Error "File not found: $filePath"
}
}
function Patch-Version {
dotnet nbgv set-version $(pake get-version)
}
function Build {
. "${msbuild}" /bl `
.\src\NanoDbProfiler.AspNetCore\NanoDbProfiler.AspNetCore.csproj `
-p:Configuration=Release `
"/t:Clean;Build" `
"/p:PublicRelease=true" `
-p:Deterministic=true
# dotnet build .\src\NanoDbProfiler.AspNetCore\NanoDbProfiler.AspNetCore.csproj /p:PublicRelease=true
}
function Pack {
dotnet pack .\src\NanoDbProfiler.AspNetCore\NanoDbProfiler.AspNetCore.csproj -o dist/ --no-build --configuration Release
}
function Publish {
dotnet tool restore
dotnet tool run nbgv set-version $(pake get-version)
# nbgv prepare-release
dotnet restore src/NanoDbProfiler.sln
# dotnet build src/NanoDbProfiler.sln --configuration Release
Build
Pack
dotnet nuget push `
"dist/NanoDbProfiler.AspNetCore.$(nbgv get-version -v NuGetPackageVersion).nupkg" `
--source https://www.myget.org/F/guneysu/api/v2/package --api-key=$env:MYGET_API_KEY
}
function Get-NugetVersion {
$nugetVersion = $(nbgv get-version -v NuGetPackageVersion)
Write-Host $nugetVersion
}