Skip to content

Commit

Permalink
Add release on github to Release target.
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtschelfthout committed Mar 15, 2017
1 parent 25a6ded commit 0a0507a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ publish/

# NuGet Packages Directory
packages/
paket-files/

# Windows Azure Build Output
csx
Expand Down
37 changes: 32 additions & 5 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ let solution = if isMono then "FsCheck-mono.sln" else "FsCheck.sln"
let testAssemblies = "tests/**/bin/Release/*.Test.dll"

// Git configuration (used for publishing documentation in gh-pages branch)
// The profile where the project is posted
let gitHome = "ssh://github.com/fscheck"
// The profile where the project is posted
let gitOwner = "fscheck"
let gitHome = sprintf "ssh://github.com/%s" gitOwner
// gitraw location - used for source linking
let gitRaw = environVarOrDefault "gitRaw" "https://raw.github.com/fscheck"
// The name of the project on GitHub
Expand Down Expand Up @@ -217,15 +218,41 @@ Target "ReleaseDocs" (fun _ ->
Branches.push tempDocsDir
)

#load "paket-files/fsharp/FAKE/modules/Octokit/Octokit.fsx"
open Octokit

Target "Release" (fun _ ->
let user =
match getBuildParam "github-user" with
| s when not (String.IsNullOrWhiteSpace s) -> s
| _ -> getUserInput "Username: "
let pw =
match getBuildParam "github-pw" with
| s when not (String.IsNullOrWhiteSpace s) -> s
| _ -> getUserPassword "Password: "
let remote =
Git.CommandHelper.getGitResult "" "remote -v"
|> Seq.filter (fun (s: string) -> s.EndsWith("(push)"))
|> Seq.tryFind (fun (s: string) -> s.Contains(gitOwner + "/" + gitName))
|> function None -> gitHome + "/" + gitName | Some (s: string) -> s.Split().[0]

StageAll ""
Commit "" (sprintf "Bump version to %s" release.NugetVersion)
Branches.push ""
Git.Commit.Commit "" (sprintf "Bump version to %s" release.NugetVersion)
Branches.pushBranch "" remote (Information.getBranchName "")

Branches.tag "" release.NugetVersion
Branches.pushTag "" "origin" release.NugetVersion
Branches.pushTag "" remote release.NugetVersion

// release on github
createClient user pw
|> createDraft gitOwner gitName release.NugetVersion (release.SemVer.PreRelease <> None) release.Notes
// to upload a file: |> uploadFile "PATH_TO_FILE"
|> releaseDraft
|> Async.RunSynchronously
)



// --------------------------------------------------------------------------------------
// Run all targets by default. Invoke 'build <Target>' to override

Expand Down
1 change: 1 addition & 0 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
source https://www.nuget.org/api/v2

nuget FAKE
github fsharp/FAKE modules/Octokit/Octokit.fsx
nuget NUnit framework: >=net452
nuget NUnit3TestAdapter version_in_path: true
nuget Unquote framework: >=net452
Expand Down
12 changes: 12 additions & 0 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ NUGET
FSharpVSPowerTools.Core (>= 2.3 < 2.4)
FSharpVSPowerTools.Core (2.3)
FSharp.Compiler.Service (>= 2.0.0.3)
Microsoft.Bcl (1.1.10) - framework: net10, net11, net20, net30, net35, net40, net40-full
Microsoft.Bcl.Build (>= 1.0.14)
Microsoft.Bcl.Build (1.0.21) - import_targets: false, framework: net10, net11, net20, net30, net35, net40, net40-full
Microsoft.DotNet.PlatformAbstractions (1.1.1) - version_in_path: true, framework: netcore10
Microsoft.Extensions.DependencyModel (1.1.1) - version_in_path: true, framework: netcore10
Microsoft.Net.Http (2.2.29) - framework: net10, net11, net20, net30, net35, net40, net40-full
Microsoft.Bcl (>= 1.1.10)
Microsoft.Bcl.Build (>= 1.0.14)
Microsoft.NETCore.Platforms (1.1) - framework: >= net10, >= netstandard10, netstandard13
Microsoft.NETCore.Targets (1.1) - framework: >= net10, >= netstandard10, netstandard13
Microsoft.TestPlatform.ObjectModel (15.0.0) - version_in_path: true, framework: netcore10
Expand All @@ -51,6 +57,8 @@ NUGET
NETStandard.Library (>= 1.6) - framework: >= net463, >= netstandard16
System.Runtime.Loader (>= 4.0) - framework: >= net463, >= netstandard16
NUnit3TestAdapter (3.7.0) - version_in_path: true
Octokit (0.24)
Microsoft.Net.Http - framework: net10, net11, net20, net30, net35, net40, net40-full
runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3) - framework: >= netstandard16
runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3) - framework: >= netstandard16
runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3) - framework: >= netstandard16
Expand Down Expand Up @@ -505,3 +513,7 @@ NUGET
Microsoft.TestPlatform.ObjectModel (>= 11.0) - framework: netcore10
NETStandard.Library (>= 1.6) - framework: netcore10
System.Threading.ThreadPool (>= 4.0.10) - framework: netcore10
GITHUB
remote: fsharp/FAKE
modules/Octokit/Octokit.fsx (d67516367361a02ae7836744e8396040ed5e4b22)
Octokit (>= 0.20)

0 comments on commit 0a0507a

Please sign in to comment.