Skip to content

Commit

Permalink
Use environVarOrNone instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Byrd authored and TheAngryByrd committed May 9, 2020
1 parent 230282e commit c9a21d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
10 changes: 3 additions & 7 deletions Content/Console/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ let runtimes = [

let disableCodeCoverage = environVarAsBoolOrDefault "DISABLE_COVERAGE" false

let githubToken = Environment.environVarOrDefault "GITHUB_TOKEN" ""
TraceSecrets.register "<GITHUB_TOKEN>" githubToken
let githubToken = Environment.environVarOrNone "GITHUB_TOKEN"
Option.iter(TraceSecrets.register "<GITHUB_TOKEN>")

//-----------------------------------------------------------------------------
// Helpers
Expand All @@ -115,10 +115,6 @@ let isRelease (targets : Target list) =
|> Seq.map(fun t -> t.Name)
|> Seq.exists ((=)"Release")

let (|NonEmptyString|_|) (s : string) =
if String.IsNullOrWhiteSpace s then None
else Some s

let isReleaseBranchCheck () =
if Git.Information.getBranchName "" <> releaseBranch then failwithf "Not on %s. If you want to release please switch to this branch." releaseBranch

Expand Down Expand Up @@ -537,7 +533,7 @@ let githubRelease _ =
allReleaseChecks ()
let token =
match githubToken with
| NonEmptyString s -> s
| Some s -> s
| _ -> failwith "please set the github_token environment variable to a github personal access token with repo access."

let files = distGlob
Expand Down
17 changes: 7 additions & 10 deletions Content/Library/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ let docsSiteBaseUrl = sprintf "https://%s.github.io/%s" gitOwner gitRepoName

let disableCodeCoverage = environVarAsBoolOrDefault "DISABLE_COVERAGE" false

let githubToken = Environment.environVarOrDefault "GITHUB_TOKEN" ""
TraceSecrets.register "<GITHUB_TOKEN>" githubToken
let githubToken = Environment.environVarOrNone "GITHUB_TOKEN"
Option.iter(TraceSecrets.register "<GITHUB_TOKEN>" )

let nugetToken = Environment.environVarOrDefault "NUGET_TOKEN" ""
TraceSecrets.register "<NUGET_TOKEN>" nugetToken

let nugetToken = Environment.environVarOrNone "NUGET_TOKEN"
Option.iter(TraceSecrets.register "<NUGET_TOKEN>")

//-----------------------------------------------------------------------------
// Helpers
Expand All @@ -113,10 +114,6 @@ let isRelease (targets : Target list) =

let invokeAsync f = async { f () }

let (|NonEmptyString|_|) (s : string) =
if String.IsNullOrWhiteSpace s then None
else Some s

let configuration (targets : Target list) =
let defaultVal = if isRelease targets then "Release" else "Debug"
match Environment.environVarOrDefault "CONFIGURATION" defaultVal with
Expand Down Expand Up @@ -562,7 +559,7 @@ let publishToNuget _ =
PublishUrl = publishUrl
WorkingDir = "dist"
ApiKey = match nugetToken with
| NonEmptyString s -> s
| Some s -> s
| _ -> c.ApiKey // assume paket-config was set properly
}
)
Expand Down Expand Up @@ -592,7 +589,7 @@ let githubRelease _ =
allReleaseChecks ()
let token =
match githubToken with
| NonEmptyString s -> s
| Some s -> s
| _ -> failwith "please set the github_token environment variable to a github personal access token with repo access."

let files = !! distGlob
Expand Down

0 comments on commit c9a21d0

Please sign in to comment.