Skip to content

Commit

Permalink
Merge pull request #67 from TheAngryByrd/36-Sourcelink-without-git-re…
Browse files Browse the repository at this point in the history
…mote

Only do sourcelink when there is a remote.origin.url
  • Loading branch information
TheAngryByrd authored Mar 11, 2018
2 parents cd73b9e + 5846e69 commit 19d0ab5
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 @@ -175,6 +175,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 "." "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 @@ -186,7 +194,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 19d0ab5

Please sign in to comment.