Skip to content

Commit

Permalink
scripts/publish: prevent uploading old versions
Browse files Browse the repository at this point in the history
After several 0.6.0--date... versions were published,
I pushed the 0.6.0 tag and that was it. Then after
that I changed the version.config to make BaseVersion
be 0.6.1 and published a 0.6.1--date... because of this.
However, I had to revert the commit and I forgot to not
include the BaseVersion change in the revert, so it
meant that a new 0.6.0--date... prerelease was published
even after v0.6.0 had already been published!

With this check in the publish script we will prevent this
from happening again.
  • Loading branch information
knocte committed Sep 3, 2024
1 parent 2536eec commit ea8e758
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions scripts/publish.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ let fullVersion =
versionConfigFile.Name
baseVersionTokenString
| Some baseVersion ->
let procResult =
Process.Execute(
{
Command = "git"
Arguments = sprintf "tag %s" baseVersion
},
Echo.Off
)

match procResult.Result with
| ProcessResultState.Error _ ->
failwithf
"Shouldn't use %s as BaseVersion (in %s) if tag %s already exists (for pushing prereleases)"
baseVersion
versionConfigFileName
baseVersion
| _ -> ()

let nugetPush =
Path.Combine(rootDir.FullName, "Tools", "nugetPush.fsx")
|> FileInfo
Expand Down

0 comments on commit ea8e758

Please sign in to comment.