File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ EndProject
1212Project ("{2150E333-8FDC-42A3-9474-1A3956D46DE8}" ) = "Build" , "Build" , "{7E33C4FF-FDB6-45C5-8748-743F48523213}"
1313 Project Section (SolutionItems ) = preProject
1414 build .fsx = build .fsx
15+ publish .fsx = publish .fsx
1516 EndProject Section
1617EndProject
1718Global
Original file line number Diff line number Diff line change 1+ #r " nuget: Fun.Build, 1.0.2"
2+ #r " nuget: Fake.Core.Environment, 5.22.0"
3+
4+ open System.IO
5+ open System.Xml .Linq
6+ open Fun.Build
7+ open Fake.Core
8+
9+ let src = __ SOURCE_ DIRECTORY__
10+
11+ let version =
12+ let project = ( FileInfo $" {src}/Elmish.Avalonia/Elmish.Avalonia.fsproj" )
13+ let doc = XDocument.Load( project.FullName)
14+ doc.Descendants( " Version" ) |> Seq.tryHead
15+ |> Option.map ( fun versionElement -> versionElement.Value)
16+ |> Option.defaultWith ( fun () -> failwith $" Could not find a <Version> element in '{project.Name}'." )
17+
18+ let nugetKey =
19+ match Environment.environVarOrNone " ELMISH_AVALONIA_NUGET_KEY" with
20+ | Some nugetKey -> nugetKey
21+ | None -> failwith " The NuGet API key must be set in an 'ELMISH_AVALONIA_NUGET_KEY' environmental variable"
22+
23+ pipeline " Publish" {
24+
25+ stage " Build Elmish.Avalonia" {
26+ run $" dotnet restore {src}/Elmish.Avalonia.sln"
27+ run $" dotnet build {src}/Elmish.Avalonia.sln --configuration Release"
28+ }
29+
30+ stage " Publish Elmish.Avalonia" {
31+ run $" dotnet nuget push \" {src}/Elmish.Avalonia/bin/Release/Elmish.Avalonia.{version}.nupkg\" -s nuget.org -k {nugetKey} --skip-duplicate"
32+ }
33+
34+ runIfOnlySpecified false
35+ }
36+
37+ tryPrintPipelineCommandHelp ()
You can’t perform that action at this time.
0 commit comments