@@ -329,3 +329,51 @@ module Git =
329329 else
330330 let lastCommitSingleOutput = lines.[ 0 ]
331331 sprintf " (%s /%s )" branch lastCommitSingleOutput
332+
333+ let GetTags () =
334+ let tags =
335+ Process.Execute({ Command = " git" ; Arguments = " tag" }, Echo.All) .UnwrapDefault()
336+
337+ let tagsSplitted = tags.Split([| " \r\n " ; " \n " |], StringSplitOptions.RemoveEmptyEntries)
338+ tagsSplitted
339+
340+ let DoesTagExist ( tagName : string ) =
341+ GetTags() |> Seq.contains tagName
342+
343+ let CreateTag ( tagName : string ) =
344+ Process.Execute({ Command = " git" ; Arguments = ( sprintf " tag %s " tagName) }, Echo.All) .UnwrapDefault()
345+ |> ignore< string>
346+
347+ let processResultRemote = Process.Execute({ Command = " git" ; Arguments = " push --tags" }, Echo.All)
348+ let _remoteResultRemote =
349+ match processResultRemote.Result with
350+ | ProcessResultState.Error(_ exitCode, output) ->
351+ failwith ( sprintf " pushing tags finished with an error: %s " output.StdErr)
352+ | _ ->
353+ ()
354+ ()
355+
356+ let CreateTagWithForce ( tagName : string ) =
357+ Process.Execute({ Command = " git" ; Arguments = sprintf " tag %s --force" tagName }, Echo.All) .UnwrapDefault()
358+ |> ignore< string>
359+
360+ let processResultRemote =
361+ Process.Execute({ Command = " git" ; Arguments = sprintf " push origin \" refs/tags/%s \" --force" tagName }, Echo.All)
362+ match processResultRemote.Result with
363+ | ProcessResultState.Error(_ exitCode, output) ->
364+ failwithf " pushing tag finished with an error: %s " output.StdErr
365+ | _ ->
366+ ()
367+
368+ let DeleteTag tagName =
369+ Process.Execute({ Command = " git" ; Arguments = ( sprintf " tag --delete %s " tagName) }, Echo.All) .UnwrapDefault()
370+ |> ignore< string>
371+
372+ let processResultRemote = Process.Execute({ Command = " git" ; Arguments = ( sprintf " push --delete origin %s " tagName) }, Echo.All)
373+ let _processResultRemote =
374+ match processResultRemote.Result with
375+ | ProcessResultState.Error(_ exitCode, output) ->
376+ failwith ( sprintf " deleting remote tag finished with an error: %s " output.StdErr)
377+ | _ ->
378+ ()
379+ ()
0 commit comments