Skip to content

Commit

Permalink
Change to DraftNewRelease and PublishDraft to match GitHub UI
Browse files Browse the repository at this point in the history
  • Loading branch information
csmager committed Oct 26, 2017
1 parent 89ab98d commit e69cb72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 5 additions & 2 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -921,9 +921,9 @@ Target.Create "FastRelease" (fun _ ->
|> List.map (fun n -> sprintf "nuget/dotnetcore/Fake.netcore/fake-dotnetcore-%s.zip" n)

GitHub.CreateClientWithToken token
|> GitHub.CreateDraftWithNotes gitOwner gitName release.NugetVersion (release.SemVer.PreRelease <> None) release.Notes
|> GitHub.DraftNewRelease gitOwner gitName release.NugetVersion (release.SemVer.PreRelease <> None) release.Notes
|> GitHub.UploadFiles files
|> GitHub.ReleaseDraft
|> GitHub.PublishDraft
|> Async.RunSynchronously
#else
let draft =
Expand All @@ -941,6 +941,9 @@ Target.Create "FastRelease" (fun _ ->
#endif
)

File.Open("C:\\dev\\helix\\blah.txt", FileMode.Truncate, FileAccess.Write)


open System
Target.Create "PrintColors" (fun _ ->
let color (color: ConsoleColor) (code : unit -> _) =
Expand Down
10 changes: 5 additions & 5 deletions src/app/Fake.Api.GitHub/GitHub.fs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ module GitHub =
/// - `repoName` - the repository's name
/// - `tagName` - the name of the tag to use for this release
/// - `prerelease` - indicates whether the release will be created as a prerelease
/// - `notes` - collection of release notes that will be inserted into the Body of the release
/// - `notes` - collection of release notes that will be inserted into the body of the release
/// - `client` - GitHub API v3 client
let CreateDraftWithNotes owner repoName tagName prerelease (notes : seq<string>) client =
let DraftNewRelease owner repoName tagName prerelease (notes : seq<string>) client =
let setParams p =
{ p with
Body = String.Join(Environment.NewLine, notes)
Expand All @@ -186,13 +186,13 @@ module GitHub =
return release'
}

/// Publishes the specified release by removing its Draft status
let ReleaseDraft (release : Async<Release>) =
/// Publishes the specified release by removing its draft status
let PublishDraft (release : Async<Release>) =
retryWithArg 5 release <| fun release' -> async {
let update = release'.Release.ToUpdate()
update.Draft <- Nullable<bool>(false)
let! released = Async.AwaitTask <| release'.Client.Repository.Release.Edit(release'.Owner, release'.RepoName, release'.Release.Id, update)
printfn "Released %d on GitHub" released.Id
printfn "Published release %d on GitHub" released.Id
}

/// Gets the latest release for the specified repository
Expand Down

0 comments on commit e69cb72

Please sign in to comment.