Skip to content

Commit fa788db

Browse files
committed
build.fsx,RELEASE.md: don't push prereleases for relNotes commits
The way we had setup the prerelease push was making unnecessary prerelease packages for the same commit that ends up being mapped to a release. But if we push the tag and the branch at the same time, and check the commit with 'git describe' then we can detect the situation and avert it.
1 parent d07553d commit fa788db

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

build.fsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,22 @@ Target.create "Push" (fun _ ->
186186
| None ->
187187
Console.WriteLine "No nuget-key env var found, skipping..."
188188
| Some key ->
189-
push key
189+
if isTag then
190+
push key
191+
else
192+
match getBuildParam "GITHUB_SHA" with
193+
| None ->
194+
failwith "GITHUB_SHA should have been populated"
195+
| Some commitHash ->
196+
let gitArgs = sprintf "describe --exact-match --tags %s" commitHash
197+
let proc =
198+
CreateProcess.fromRawCommandLine "git" gitArgs
199+
|> Proc.run
200+
if proc.ExitCode <> 0 then
201+
// commit is not a tag, so go ahead pushing a prerelease
202+
push key
203+
else
204+
Console.WriteLine "Commit mapped to a tag, skipping pushing prerelease..."
190205
| _ ->
191206
Console.WriteLine "Github event name not 'push', skipping..."
192207

0 commit comments

Comments
 (0)