Skip to content

Commit

Permalink
Minor git commit improvement for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Jan 25, 2024
1 parent 4d7f4b8 commit 5b62fb6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions build/Build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,25 @@ module ReleaseNoteTasks =

open Fake.Extensions.Release

let createVersionFile(version: string) =
let createVersionFile(version: string, commit: bool) =
let releaseDate = System.DateTime.UtcNow.ToShortDateString()
Fake.DotNet.AssemblyInfoFile.createFSharp "src/Server/Version.fs"
[ Fake.DotNet.AssemblyInfo.Title "Swate"
Fake.DotNet.AssemblyInfo.Version version
Fake.DotNet.AssemblyInfo.Metadata ("Version",version)
Fake.DotNet.AssemblyInfo.Metadata ("ReleaseDate",releaseDate)
]
if commit then
run git ["add"; "."] __SOURCE_DIRECTORY__
run git ["commit"; "-m"; (sprintf "Release v%s :bookmark:" ProjectInfo.prereleaseTag)] __SOURCE_DIRECTORY__

let updateReleaseNotes = Target.create "releasenotes" (fun config ->
ReleaseNotes.ensure()

ReleaseNotes.update(ProjectInfo.gitOwner, ProjectInfo.project, config)

let newRelease = ReleaseNotes.load "RELEASE_NOTES.md"
createVersionFile(newRelease.AssemblyVersion)
createVersionFile(newRelease.AssemblyVersion, false)

Trace.trace "Update Version.fs done!"

Expand Down Expand Up @@ -223,7 +226,6 @@ module Release =

open System.Diagnostics


let GetLatestGitTag () : string =
let executeCommand (command: string) : string =
let p = new Process()
Expand Down Expand Up @@ -265,8 +267,6 @@ module Release =

let ForcePushNightly() =
if promptYesNo "Ready to force push release to nightly branch?" then
run git ["add"; "."] __SOURCE_DIRECTORY__
run git ["commit"; "-m"; (sprintf "Release v%s" ProjectInfo.prereleaseTag)] __SOURCE_DIRECTORY__
run git ["push"; "-f"; "origin"; "HEAD:nightly"] __SOURCE_DIRECTORY__
else
failwith "aborted"
Expand Down Expand Up @@ -405,7 +405,7 @@ let main args =
Release.SetPrereleaseTag()
Release.CreatePrereleaseTag()
let version = Release.GetLatestGitTag()
ReleaseNoteTasks.createVersionFile(version)
ReleaseNoteTasks.createVersionFile(version, true)
Release.ForcePushNightly()
0
| _ ->
Expand All @@ -421,7 +421,7 @@ let main args =
| _ -> runOrDefault args
| "version" :: a ->
match a with
| "create-file" :: version :: a -> ReleaseNoteTasks.createVersionFile(version); 0
| "create-file" :: version :: a -> ReleaseNoteTasks.createVersionFile(version, false); 0
| _ -> runOrDefault args
| "cmdtest" :: a ->
run git ["add"; "."] ""
Expand Down

0 comments on commit 5b62fb6

Please sign in to comment.