Skip to content

Commit

Permalink
Automate Github releases
Browse files Browse the repository at this point in the history
  • Loading branch information
SCullman committed Sep 15, 2019
1 parent d0d42ff commit f6a2020
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ bin/
*.nupkg
.fake/
.install/
setEnv.ps1
29 changes: 21 additions & 8 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.DotNet
open Fake.JavaScript
open Fake.Core
open Fake.Api
open Markdig
open System.Xml

//Properties
let packageName = "dnn.resx"
let packageName = "Dnn.Resx"
let installDir = ".install"
let buildDir = "src/bin/debug"
let packageDir = installDir </> "package"
let deployDir = installDir </> "deploy"
let changeLogFile = "RELEASENOTES.md"
let manifestFile = (sprintf "%s.dnn" packageName )


let gitOwner = "scullman"
let gitName = packageName

[<RequireQualifiedAccess>]
module Xml =
Expand Down Expand Up @@ -65,8 +65,6 @@ Target.create "AssemblyInfo" (fun _ ->
]
)



let copyAssemblies folder =
!! (buildDir </> "*.dll")
|> Shell.copyTo folder
Expand Down Expand Up @@ -138,9 +136,23 @@ Target.create "PackModule" (fun _ ->
createModulePackage ()
)

Target.create "GitHubRelease" (fun _ ->
let token =
match Environment.environVarOrDefault "github_token" "" with
| s when not (System.String.IsNullOrWhiteSpace s) -> s
| _ -> failwith "please set the github_token environment variable to a github personal access token with repro access."

Target.create "Run" (fun _->
Trace.trace "Running - enjoy" )
let files = !! (installDir </> "*-install.zip")

let changelog = changeLogFile |> Changelog.load
let version = changelog.LatestEntry.AssemblyVersion
let notes = [| defaultArg changelog.LatestEntry.Description "[TBD]" |]

GitHub.createClientWithToken token
|> GitHub.draftNewRelease gitOwner gitName version true notes
|> GitHub.uploadFiles files
|> GitHub.publishDraft
|> Async.RunSynchronously)

open Fake.Core.TargetOperators

Expand All @@ -151,6 +163,7 @@ open Fake.Core.TargetOperators
==> "BuildServices"
==> "PackModule"
==> "Default"
==> "GitHubRelease"

// start build
Target.runOrDefault "Default"
1 change: 1 addition & 0 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ group Build
source https://www.nuget.org/api/v2
storage:none
nuget FSharp.Core
nuget Fake.Api.GitHub
nuget Fake.IO.FileSystem
nuget Fake.IO.Zip
nuget Fake.DotNet.MsBuild
Expand Down
7 changes: 6 additions & 1 deletion paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ NUGET
BlackFox.VsWhere (1.0) - restriction: || (>= net462) (>= netstandard2.0)
FSharp.Core (>= 4.0.0.1) - restriction: >= net45
FSharp.Core (>= 4.2.3) - restriction: && (< net45) (>= netstandard2.0)
Fake.Api.GitHub (5.16.1)
FSharp.Core (>= 4.7) - restriction: || (>= net462) (>= netstandard2.0)
Octokit (>= 0.32) - restriction: || (>= net462) (>= netstandard2.0)
Fake.Core.CommandLineParsing (5.16.1) - restriction: || (>= net462) (>= netstandard2.0)
FParsec (>= 1.0.3) - restriction: || (>= net462) (>= netstandard2.0)
FSharp.Core (>= 4.7) - restriction: || (>= net462) (>= netstandard2.0)
Expand Down Expand Up @@ -168,8 +171,10 @@ NUGET
Microsoft.Build.Tasks.Core (>= 15.8.166) - restriction: && (< net46) (>= netstandard2.0)
Microsoft.Build.Utilities.Core (>= 14.3) - restriction: >= net46
Microsoft.Build.Utilities.Core (>= 15.8.166) - restriction: && (< net46) (>= netstandard2.0)
NETStandard.Library (2.0.3) - restriction: || (&& (< net40) (>= net462) (>= netstandard1.6)) (&& (< net40) (>= netstandard2.0)) (>= uap10.1)
NETStandard.Library (2.0.3) - restriction: || (&& (< net40) (>= net462) (>= netstandard1.6)) (&& (< net40) (>= netstandard2.0)) (&& (< net45) (>= net462)) (&& (< net45) (>= netstandard2.0)) (>= uap10.1)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (>= net45) (< netstandard1.3)) (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< win8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.4) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.4) (< netstandard1.5) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81)) (&& (< net45) (>= netstandard2.0)) (&& (>= net46) (< netstandard1.4)) (>= net461) (>= netcoreapp2.0) (&& (>= netstandard1.0) (< portable-net45+win8+wpa81)) (&& (< netstandard1.0) (>= portable-net45+win8) (< win8)) (&& (< netstandard1.0) (< portable-net45+win8) (>= portable-net45+win8+wpa81)) (&& (< netstandard1.0) (>= portable-net45+win8+wp8+wpa81) (< portable-net45+win8+wpa81)) (&& (< netstandard1.0) (>= win8)) (&& (< netstandard1.3) (< win8) (>= wpa81)) (&& (< netstandard1.5) (>= uap10.0)) (>= uap10.1) (>= wp8)
Octokit (0.33) - restriction: || (>= net462) (>= netstandard2.0)
NETStandard.Library (>= 1.6) - restriction: && (< net45) (>= netstandard1.1)
runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac)
runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac)
runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac)
Expand Down
8 changes: 4 additions & 4 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// <auto-generated/>
using System.Reflection;

[assembly: AssemblyProduct("dnn.resx")]
[assembly: AssemblyDescription("dnn.resx")]
[assembly: AssemblyProduct("Dnn.Resx")]
[assembly: AssemblyDescription("Dnn.Resx")]
[assembly: AssemblyVersion("0.1.0")]
[assembly: AssemblyFileVersion("0.1.0")]
namespace System {
internal static class AssemblyVersionInformation {
internal const System.String AssemblyProduct = "dnn.resx";
internal const System.String AssemblyDescription = "dnn.resx";
internal const System.String AssemblyProduct = "Dnn.Resx";
internal const System.String AssemblyDescription = "Dnn.Resx";
internal const System.String AssemblyVersion = "0.1.0";
internal const System.String AssemblyFileVersion = "0.1.0";
}
Expand Down

0 comments on commit f6a2020

Please sign in to comment.