Skip to content

Commit c38e3ac

Browse files
authored
Update release process (#3736)
1 parent b56f677 commit c38e3ac

File tree

3 files changed

+20
-29
lines changed

3 files changed

+20
-29
lines changed

build/NEST.JsonNetSerializer.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<projectUrl>https://github.com/elastic/elasticsearch-net</projectUrl>
1111
<iconUrl>https://raw.githubusercontent.com/elastic/elasticsearch-net/master/build/nuget-icon.png</iconUrl>
1212
<requireLicenseAcceptance>false</requireLicenseAcceptance>
13-
<description>NEST 6.x uses an internalized Json.NET serializer. This package enables serialization using your own custom Json.NET serializer</description>
14-
<summary>NEST 6.x uses an internalized Json.NET serializer. This package enables serialization using your own custom Json.NET serializer</summary>
13+
<description>NEST uses an internal Json.NET serializer. This package enables serialization for your documents using your own custom Json.NET serializer</description>
14+
<summary>NEST uses an internal Json.NET serializer. This package enables serialization for your documents using your own custom Json.NET serializer</summary>
1515
<releaseNotes>See https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
1616
<copyright>2017-$year$ Elasticsearch BV</copyright>
1717
<tags>elasticsearch,elastic,search,lucene,nest,serializer,json</tags>

build/scripts/Releasing.fs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ open System.Text
77
open System.Xml
88
open System.Xml.Linq
99
open System.Xml.XPath
10-
open Microsoft.FSharp.Quotations
11-
open Microsoft.FSharp.Quotations.Patterns
10+
open Fake.Core
1211

1312
open Projects
1413
open Versioning
@@ -34,15 +33,7 @@ module Release =
3433
let semanticVersion = parse version
3534
sprintf "%i" (semanticVersion.Major + 1u)
3635

37-
let private addKeyValue (e:Expr<string>) (builder:StringBuilder) =
38-
// the binding for this tuple looks like key/value should
39-
// be round the other way (but it's correct as is)...
40-
let (value,key) =
41-
match e with
42-
| PropertyGet (eo, pi, li) -> (pi.Name, (pi.GetValue(e) |> string))
43-
| ValueWithName (obj,ty,nm) -> ((obj |> string), nm)
44-
| _ -> failwith (sprintf "%A is not a let-bound value. %A" e (e.GetType()))
45-
36+
let private addKeyValue key value (builder:StringBuilder) =
4637
if (not (String.IsNullOrEmpty value)) then builder.AppendFormat("{0}=\"{1}\";", key, value)
4738
else builder
4839

@@ -53,9 +44,9 @@ module Release =
5344
let currentMajorVersion = currentMajorVersion version
5445
let nextMajorVersion = nextMajorVersion version
5546
new StringBuilder()
56-
|> addKeyValue <@currentMajorVersion@>
57-
|> addKeyValue <@nextMajorVersion@>
58-
|> addKeyValue <@year@>
47+
|> addKeyValue "currentMajorVersion" currentMajorVersion
48+
|> addKeyValue "nextMajorVersion" nextMajorVersion
49+
|> addKeyValue "year" year
5950

6051
let pack file n properties version =
6152
Tooling.Nuget.Exec [ "pack"; file;
@@ -140,9 +131,9 @@ module Release =
140131

141132
let properties =
142133
props version
143-
|> addKeyValue <@jsonDotNetCurrentVersion@>
144-
|> addKeyValue <@jsonDotNetNextVersion@>
145-
let properties = properties.ToString()
134+
|> addKeyValue "jsonDotNetCurrentVersion" jsonDotNetCurrentVersion
135+
|> addKeyValue "jsonDotNetNextVersion" jsonDotNetNextVersion
136+
|> StringBuilder.toText
146137

147138
let nugetId = p.NugetId
148139
let nuspec = (sprintf @"build/%s.nuspec" nugetId)

build/scripts/Versioning.fs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ module Versioning =
1919
let parse (v:string) = SemVer.parse(v)
2020

2121
//Versions in form of e.g 6.1.0 is inferred as datetime so we bake the json shape into the provider like this
22-
type SdkVersion = { Version:string; }
23-
type GlobalJson = { Sdk: SdkVersion; Version:string; }
22+
type SdkVersion = { version:string; }
23+
type GlobalJson = { sdk: SdkVersion; version:string; }
2424

2525
let private globalJson () =
2626
let jsonString = File.ReadAllText "global.json"
2727
JsonConvert.DeserializeObject<GlobalJson>(jsonString)
2828

2929
let writeVersionIntoGlobalJson version =
3030
let globalJson = globalJson ()
31-
let newGlobalJson = { globalJson with Version = version.ToString(); }
31+
let newGlobalJson = { globalJson with version = version.ToString(); }
3232
File.WriteAllText("global.json", JsonConvert.SerializeObject(newGlobalJson))
3333
printfn "Written (%s) to global.json as the current version will use this version from now on as current in the build" (version.ToString())
3434

35-
let GlobalJsonVersion = parse <| globalJson().Version
35+
let GlobalJsonVersion = parse <| globalJson().version
3636

3737
let private getVersion (args:Commandline.PassedArguments) =
3838
match (args.Target, args.CommandArguments) with
@@ -73,9 +73,9 @@ module Versioning =
7373
match version with
7474
| NoChange _ -> failwithf "cannot run release because no explicit version number was passed on the command line"
7575
| Update (newVersion, currentVersion) ->
76-
// fail if current is greater or equal to the new version
77-
if (currentVersion >= newVersion) then
78-
failwithf "Can not release %O its lower then current %O" newVersion.Full currentVersion.Full
76+
// fail if current is greater than the new version
77+
if (currentVersion > newVersion) then
78+
failwithf "Can not release %O as it's lower than current %O" newVersion.Full currentVersion.Full
7979
writeVersionIntoGlobalJson newVersion.Full
8080
| _ -> ignore()
8181

@@ -103,7 +103,7 @@ module Versioning =
103103
| Some sn -> sn
104104
| None -> failwithf "Could not locate sn.exe"
105105

106-
let private oficialToken = "96c599bbe3e70f5d"
106+
let private officialToken = "96c599bbe3e70f5d"
107107

108108
let private validate dll name =
109109
let sn = sn ()
@@ -122,8 +122,8 @@ module Versioning =
122122

123123
let valid = (out.ExitCode, token)
124124
match valid with
125-
| (Some 0, t) when t = oficialToken -> printfn "%s was signed with official key token %s" name t
126-
| (_, t) -> printfn "%s was not signed with the official token: %s but %s" name oficialToken t
125+
| (Some 0, t) when t = officialToken -> printfn "%s was signed with official key token %s" name t
126+
| (_, t) -> printfn "%s was not signed with the official token: %s but %s" name officialToken t
127127

128128
let private validateDllStrongName dll name =
129129
match File.Exists dll with

0 commit comments

Comments
 (0)