Skip to content

Commit

Permalink
Only do sourcelink when there is a remote.origin.url
Browse files Browse the repository at this point in the history
closes #36
  • Loading branch information
Jimmy Byrd committed Mar 11, 2018
1 parent 98da27e commit f7f9519
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Content/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ Target "AssemblyInfo" (fun _ ->
)

Target "DotnetPack" (fun _ ->
// https://github.com/ctaggart/SourceLink relies on a some git depedencies.
// Checks if there's a remote.origin.url and the last git hash.
let remoteOriginOk, remoteMessages, _ = Git.CommandHelper.runGitCommand "." "config --get remote.origin.url"
let sha1Ok, sha1Message, _ = Git.CommandHelper.runGitCommand "." "git rev-parse HEAD"
let canSourceLink =
remoteOriginOk && (remoteMessages |> Seq.length > 0)
&& sha1Ok && (sha1Message |> Seq.length > 0)

!! srcGlob
|> Seq.iter (fun proj ->
DotNetCli.Pack (fun c ->
Expand All @@ -183,7 +191,7 @@ Target "DotnetPack" (fun _ ->
[
sprintf "/p:PackageVersion=%s" release.NugetVersion
sprintf "/p:PackageReleaseNotes=\"%s\"" (String.Join("\n",release.Notes))
"/p:SourceLinkCreate=true"
sprintf "/p:SourceLinkCreate=%b" canSourceLink
]
})
)
Expand Down

0 comments on commit f7f9519

Please sign in to comment.