Skip to content

Commit 0a0507a

Browse files
Add release on github to Release target.
1 parent 25a6ded commit 0a0507a

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ publish/
102102

103103
# NuGet Packages Directory
104104
packages/
105+
paket-files/
105106

106107
# Windows Azure Build Output
107108
csx

build.fsx

+32-5
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ let solution = if isMono then "FsCheck-mono.sln" else "FsCheck.sln"
4242
let testAssemblies = "tests/**/bin/Release/*.Test.dll"
4343

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

221+
#load "paket-files/fsharp/FAKE/modules/Octokit/Octokit.fsx"
222+
open Octokit
223+
220224
Target "Release" (fun _ ->
225+
let user =
226+
match getBuildParam "github-user" with
227+
| s when not (String.IsNullOrWhiteSpace s) -> s
228+
| _ -> getUserInput "Username: "
229+
let pw =
230+
match getBuildParam "github-pw" with
231+
| s when not (String.IsNullOrWhiteSpace s) -> s
232+
| _ -> getUserPassword "Password: "
233+
let remote =
234+
Git.CommandHelper.getGitResult "" "remote -v"
235+
|> Seq.filter (fun (s: string) -> s.EndsWith("(push)"))
236+
|> Seq.tryFind (fun (s: string) -> s.Contains(gitOwner + "/" + gitName))
237+
|> function None -> gitHome + "/" + gitName | Some (s: string) -> s.Split().[0]
238+
221239
StageAll ""
222-
Commit "" (sprintf "Bump version to %s" release.NugetVersion)
223-
Branches.push ""
240+
Git.Commit.Commit "" (sprintf "Bump version to %s" release.NugetVersion)
241+
Branches.pushBranch "" remote (Information.getBranchName "")
224242

225243
Branches.tag "" release.NugetVersion
226-
Branches.pushTag "" "origin" release.NugetVersion
244+
Branches.pushTag "" remote release.NugetVersion
245+
246+
// release on github
247+
createClient user pw
248+
|> createDraft gitOwner gitName release.NugetVersion (release.SemVer.PreRelease <> None) release.Notes
249+
// to upload a file: |> uploadFile "PATH_TO_FILE"
250+
|> releaseDraft
251+
|> Async.RunSynchronously
227252
)
228253

254+
255+
229256
// --------------------------------------------------------------------------------------
230257
// Run all targets by default. Invoke 'build <Target>' to override
231258

paket.dependencies

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
source https://www.nuget.org/api/v2
22

33
nuget FAKE
4+
github fsharp/FAKE modules/Octokit/Octokit.fsx
45
nuget NUnit framework: >=net452
56
nuget NUnit3TestAdapter version_in_path: true
67
nuget Unquote framework: >=net452

paket.lock

+12
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@ NUGET
4040
FSharpVSPowerTools.Core (>= 2.3 < 2.4)
4141
FSharpVSPowerTools.Core (2.3)
4242
FSharp.Compiler.Service (>= 2.0.0.3)
43+
Microsoft.Bcl (1.1.10) - framework: net10, net11, net20, net30, net35, net40, net40-full
44+
Microsoft.Bcl.Build (>= 1.0.14)
45+
Microsoft.Bcl.Build (1.0.21) - import_targets: false, framework: net10, net11, net20, net30, net35, net40, net40-full
4346
Microsoft.DotNet.PlatformAbstractions (1.1.1) - version_in_path: true, framework: netcore10
4447
Microsoft.Extensions.DependencyModel (1.1.1) - version_in_path: true, framework: netcore10
48+
Microsoft.Net.Http (2.2.29) - framework: net10, net11, net20, net30, net35, net40, net40-full
49+
Microsoft.Bcl (>= 1.1.10)
50+
Microsoft.Bcl.Build (>= 1.0.14)
4551
Microsoft.NETCore.Platforms (1.1) - framework: >= net10, >= netstandard10, netstandard13
4652
Microsoft.NETCore.Targets (1.1) - framework: >= net10, >= netstandard10, netstandard13
4753
Microsoft.TestPlatform.ObjectModel (15.0.0) - version_in_path: true, framework: netcore10
@@ -51,6 +57,8 @@ NUGET
5157
NETStandard.Library (>= 1.6) - framework: >= net463, >= netstandard16
5258
System.Runtime.Loader (>= 4.0) - framework: >= net463, >= netstandard16
5359
NUnit3TestAdapter (3.7.0) - version_in_path: true
60+
Octokit (0.24)
61+
Microsoft.Net.Http - framework: net10, net11, net20, net30, net35, net40, net40-full
5462
runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3) - framework: >= netstandard16
5563
runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3) - framework: >= netstandard16
5664
runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3) - framework: >= netstandard16
@@ -505,3 +513,7 @@ NUGET
505513
Microsoft.TestPlatform.ObjectModel (>= 11.0) - framework: netcore10
506514
NETStandard.Library (>= 1.6) - framework: netcore10
507515
System.Threading.ThreadPool (>= 4.0.10) - framework: netcore10
516+
GITHUB
517+
remote: fsharp/FAKE
518+
modules/Octokit/Octokit.fsx (d67516367361a02ae7836744e8396040ed5e4b22)
519+
Octokit (>= 0.20)

0 commit comments

Comments
 (0)