-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.ps1
51 lines (32 loc) · 881 Bytes
/
release.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
$ErrorActionPreference = "Stop"
dotnet build
dotnet test
$projectXml = [xml](Get-Content .\Consolo\Consolo.csproj)
$version = $projectXml.Project.PropertyGroup[1].version
if ($version -eq $null) {
Write-Host "Version not found in project file"
exit 1
}
Write-Host "Version: $version"
$tagName = "release/$version"
write-host "Debug: git tags"
git tag -l
$versionAlreadyTagged = git tag -l $tagName
if ($versionAlreadyTagged) {
Write-Host "Version $version already tagged"
exit 0
}
dotnet pack Consolo -o .
$nupkg = get-item Consolo.$version.nupkg
if (-not $nupkg) {
Write-Host "NuGet package not found"
exit 1
}
write-host $nupkg
dotnet nuget push `
$nupkg `
--api-key $env:NUGET_API_KEY_CONSOLO_CI `
--source https://api.nuget.org/v3/index.json
Write-Host "Creating tag $tagName"
git tag $tagName
git push origin tag $tagName