Skip to content
Snippets Groups Projects
Commit fc593bb2 authored by L. Ellenbeck's avatar L. Ellenbeck
Browse files

Working variation

parent 1e0b0ec6
No related branches found
No related tags found
1 merge request!21Topic/570 git version
...@@ -138,7 +138,7 @@ Task("GitlabRelease") ...@@ -138,7 +138,7 @@ Task("GitlabRelease")
var tagList = result.Content.ReadAsStringAsync().Result; var tagList = result.Content.ReadAsStringAsync().Result;
var jArray = JArray.Parse(tagList); var jArray = JArray.Parse(tagList);
// null if not tags exists yet // null if not tags exists yet
var lastTag = jArray.FirstOrDefault(); var lastTag = jArray.Select(x => x["name"]).FirstOrDefault();
var url = $"https://git.rwth-aachen.de/{gitlabProjectPath}"; var url = $"https://git.rwth-aachen.de/{gitlabProjectPath}";
...@@ -165,12 +165,14 @@ Task("GitlabRelease") ...@@ -165,12 +165,14 @@ Task("GitlabRelease")
logParam = $"{lastTag}..Head"; logParam = $"{lastTag}..Head";
} }
Information(lastTag);
IEnumerable<string> redirectedStandardOutput; IEnumerable<string> redirectedStandardOutput;
var exitCodeWithArgument = var exitCodeWithArgument =
StartProcess( StartProcess(
"git", "git",
new ProcessSettings { new ProcessSettings {
Arguments = $"log {logParam} --pretty=format:'%h %B'", Arguments = $"log {logParam} --pretty=format:HASH%h:%B",
RedirectStandardOutput = true RedirectStandardOutput = true
}, },
out redirectedStandardOutput out redirectedStandardOutput
...@@ -187,14 +189,22 @@ Task("GitlabRelease") ...@@ -187,14 +189,22 @@ Task("GitlabRelease")
{"Chore", new List<string>()}, {"Chore", new List<string>()},
}; };
var currentHash = "";
// Output last line of process output. // Output last line of process output.
foreach(var line in redirectedStandardOutput) { foreach(var line in redirectedStandardOutput) {
var index = line.IndexOf(" "); var commitMessage = "";
var commitHash = line.Substring(0, index); if(line.StartsWith("HASH")) {
var commitMessage = line.Substring(index + 1); currentHash = line.Substring("HASH".Length);
currentHash = currentHash.Substring(0, currentHash.IndexOf(":"));
commitMessage = line.Substring(currentHash.Length + line.IndexOf(currentHash) + 1);
} else {
commitMessage = line;
}
foreach(var kv in prefixList) { foreach(var kv in prefixList) {
if(commitMessage.StartsWith($"{kv.Key}:")) { if(commitMessage.StartsWith($"{kv.Key}:")) {
kv.Value.Add($"* {commitMessage.Substring(kv.Key.Length + 1).Trim()} {commitHash}"); kv.Value.Add($"* {commitMessage.Substring(kv.Key.Length + 1).Trim()} {currentHash}");
break;
} }
}; };
} }
...@@ -210,7 +220,7 @@ Task("GitlabRelease") ...@@ -210,7 +220,7 @@ Task("GitlabRelease")
} }
// correctly escape the json newlines // correctly escape the json newlines
description = description.Replace("\n", "\\n"); description = description.Replace("\n", "\\n");
Information("{0}", description); Information("Description: {0}", description);
throw new Exception(); throw new Exception();
// create tag // create tag
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment