forked from fsprojects/FSharpLint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts: convert
Push
target to fsx script
The `Default` target & common stuff has also been removed due to its dependency on `Pack`. Co-authored-by: webwarrior <[email protected]>
- Loading branch information
1 parent
b56617c
commit 7bcf598
Showing
3 changed files
with
49 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#r "nuget: Fake.Core.UserInput" | ||
#r "nuget: Fake.DotNet.Paket" | ||
#load "common.fsx" | ||
#load "pack.fsx" | ||
|
||
open System | ||
|
||
open Fake.Core | ||
open Fake.DotNet | ||
|
||
open Common | ||
|
||
let push key = | ||
Paket.push (fun p -> { p with WorkingDir = nugetDir; ApiKey = key; ToolType = ToolType.CreateLocalTool() }) | ||
|
||
let key = getBuildParam "nuget-key" | ||
match getBuildParam "GITHUB_EVENT_NAME" with | ||
| None -> | ||
match key with | ||
| None -> | ||
let key = UserInput.getUserPassword "NuGet Key: " | ||
push key | ||
| Some key -> | ||
push key | ||
|
||
| Some "push" -> | ||
match key with | ||
| None -> | ||
Console.WriteLine "No nuget-key env var found, skipping..." | ||
| Some key -> | ||
if isTag then | ||
push key | ||
else | ||
match getBuildParam "GITHUB_SHA" with | ||
| None -> | ||
failwith "GITHUB_SHA should have been populated" | ||
| Some commitHash -> | ||
let gitArgs = sprintf "describe --exact-match --tags %s" commitHash | ||
let proc = | ||
CreateProcess.fromRawCommandLine "git" gitArgs | ||
|> Proc.run | ||
if proc.ExitCode <> 0 then | ||
// commit is not a tag, so go ahead pushing a prerelease | ||
push key | ||
else | ||
Console.WriteLine "Commit mapped to a tag, skipping pushing prerelease..." | ||
| _ -> | ||
Console.WriteLine "Github event name not 'push', skipping..." |