Skip to content

Instantly share code, notes, and snippets.

@flagbug
Created April 24, 2018 14:49
Show Gist options
  • Save flagbug/593f2969e9c40f9afb2c60d07de1ae58 to your computer and use it in GitHub Desktop.
Save flagbug/593f2969e9c40f9afb2c60d07de1ae58 to your computer and use it in GitHub Desktop.
Task("Version")
.Does(() =>
{
IEnumerable<string> redirectedStandardOutput;
IEnumerable<string> redirectedErrorOutput;
var exitCodeWithArgument =
StartProcess(
"git",
new ProcessSettings {
Arguments = "rev-parse HEAD",
RedirectStandardOutput = true
},
out redirectedStandardOutput,
out redirectedErrorOutput
);
string gitCommitHash = redirectedStandardOutput.Single();
ReplaceTextInFiles("path_to_your_appsettings", "%BUILD_COMMIT_HASH%", gitCommitHash);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment