Skip to content

Commit 98cb954

Browse files
committed
Prompt for username/password, and choose remote - as in fsprojects/ProjectScaffold#200
1 parent fcaae9c commit 98cb954

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

build.fsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ open Fake.AppVeyor
1010
open Fake
1111
open Fake.Git
1212
open Fake.ReleaseNotesHelper
13+
open Fake.UserInputHelper
1314
open Fake.AssemblyInfoFile
1415
open SourceLink
1516

@@ -186,15 +187,29 @@ Target "ReleaseDocs" (fun _ ->
186187
open Octokit
187188

188189
Target "Release" (fun _ ->
190+
let user =
191+
match getBuildParam "github-user" with
192+
| s when not (String.IsNullOrWhiteSpace s) -> s
193+
| _ -> getUserInput "Username: "
194+
let pw =
195+
match getBuildParam "github-pw" with
196+
| s when not (String.IsNullOrWhiteSpace s) -> s
197+
| _ -> getUserPassword "Password: "
198+
let remote =
199+
Git.CommandHelper.getGitResult "" "remote -v"
200+
|> Seq.filter (fun (s: string) -> s.EndsWith("(push)"))
201+
|> Seq.tryFind (fun (s: string) -> s.Contains(gitOwner + "/" + gitName))
202+
|> function None -> gitHome + "/" + gitName | Some (s: string) -> s.Split().[0]
203+
189204
StageAll ""
190205
Git.Commit.Commit "" (sprintf "Bump version to %s" release.NugetVersion)
191-
Branches.push ""
206+
Branches.pushBranch "" remote (Information.getBranchName "")
192207

193208
Branches.tag "" release.NugetVersion
194-
Branches.pushTag "" "origin" release.NugetVersion
209+
Branches.pushTag "" remote release.NugetVersion
195210

196211
// release on github
197-
createClient (getBuildParamOrDefault "github-user" "") (getBuildParamOrDefault "github-pw" "")
212+
createClient user pw
198213
|> createDraft gitOwner gitName release.NugetVersion (release.SemVer.PreRelease <> None) release.Notes
199214
|> releaseDraft
200215
|> Async.RunSynchronously

0 commit comments

Comments
 (0)