Skip to content

Commit

Permalink
Add support any pre-release suffix instead of hardcoded ones only
Browse files Browse the repository at this point in the history
  • Loading branch information
zvirja committed Apr 10, 2017
1 parent ce56bf9 commit 488db65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type GitVersion = { apiVersion:string; nugetVersion:string }
let getGitVersion =
let desc = Git.CommandHelper.runSimpleGitCommand "" "describe --tags --long --match=v*"
// Example for regular: v3.50.2-288-g64fd5c5b, for prerelease: v3.50.2-alpha1-288-g64fd5c5b
let result = Regex.Match(desc, @"^v(?<maj>\d+)\.(?<min>\d+)\.(?<rev>\d+)(?<pre>-(alpha|beta|rc)\d*)?-(?<num>\d+)-g(?<sha>[a-z0-9]+)$", RegexOptions.IgnoreCase).Groups
let result = Regex.Match(desc, @"^v(?<maj>\d+)\.(?<min>\d+)\.(?<rev>\d+)(?<pre>-\w+\d*)?-(?<num>\d+)-g(?<sha>[a-z0-9]+)$", RegexOptions.IgnoreCase).Groups
let getMatch (name:string) = result.[name].Value

let assemblyVer = sprintf "%s.%s.%s" (getMatch "maj") (getMatch "min") (getMatch "rev")
Expand Down

0 comments on commit 488db65

Please sign in to comment.