-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpsakefile.ps1
More file actions
46 lines (36 loc) · 1.56 KB
/
psakefile.ps1
File metadata and controls
46 lines (36 loc) · 1.56 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
Task PublishCSharp -Depends PackCSharp {
$nupkg = Join-Path -Path $script:trashFolder -ChildPath "TIKSN.Lionize.Messaging.$script:NextVersion.nupkg"
$nupkg = Resolve-Path -Path $nupkg
$nupkg = $nupkg.Path
$apiKey = [Environment]::GetEnvironmentVariable('TIKSN-Lionize-Messaging-ApiKey')
Exec { nuget push $nupkg -ApiKey $apiKey -Source https://api.nuget.org/v3/index.json }
}
Task PackCSharp -Depends BuildCSharp, EstimateVersions {
$project = "./src/CSharp/CSharp.csproj"
$project = Resolve-Path $project
$project = $project.Path
Exec { dotnet pack --configuration Release --output $script:trashFolder -p:version=$script:NextVersion $project }
}
Task EstimateVersions {
$Version = [Version]$Version
Assert ($Version.Revision -eq -1) "Version should be formatted as Major.Minor.Patch like 1.2.3"
Assert ($Version.Build -ne -1) "Version should be formatted as Major.Minor.Patch like 1.2.3"
$Version = $Version.ToString()
$script:NextVersion = $Version
}
Task BuildCSharp -Depends Clean {
$solution = Resolve-Path "./src/Messaging.sln"
$solution = $solution.Path
Exec { dotnet restore $solution }
Exec { dotnet build $solution }
}
Task Clean -Depends Init {
}
Task Init {
$date = Get-Date
$ticks = $date.Ticks
$script:trashFolder = Join-Path -Path . -ChildPath ".trash"
$script:trashFolder = Join-Path -Path $script:trashFolder -ChildPath $ticks.ToString("D19")
New-Item -Path $script:trashFolder -ItemType Directory | Out-Null
$script:trashFolder = Resolve-Path -Path $script:trashFolder
}