Skip to content

Commit 4e688f3

Browse files
committed
Add changelog to github release
1 parent 6936eba commit 4e688f3

File tree

2 files changed

+52
-48
lines changed

2 files changed

+52
-48
lines changed

Editor/BuildManager/BuildPipeline/BuildManager.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static void CreateGitHubRelease(BuildManagerSettings settings) {
492492
args.Append($"--tag v{PlayerSettings.bundleVersion} ");
493493
args.Append($"--name \"{buildNameString}\" ");
494494
//TODO:
495-
args.Append($"--description \"Changelog, readme, etc\" ");
495+
args.Append($"--description \"{usedChangelog.GetLastChangelogString()}\" ");
496496

497497

498498
Debug.Log(fileName.ToString() + args.ToString());

Editor/Changelog/ChangelogData.cs

+51-47
Original file line numberDiff line numberDiff line change
@@ -21,61 +21,23 @@ public ChangelogVersionEntry GetLastVersion() {
2121
public string GetChangelogString() {
2222
StringBuilder sb = new StringBuilder();
2323

24-
ChangelogEntryType lastType;
25-
ChangelogEntryScope lastScope;
26-
2724
sb.Append("Note: 📢 indicates a change inspired by community feedback!\n");
28-
sb.Append("---------- \n");
2925

3026
for (int i = versions.Count - 1; i >= 0; --i) {
31-
lastType = (ChangelogEntryType)255;
32-
lastScope = (ChangelogEntryScope)255;
33-
ChangelogVersionEntry version = versions[i];
34-
35-
if (i != versions.Count - 1) {
36-
sb.Append("---------- \n");
37-
38-
}
39-
sb.Append("# ");
40-
sb.Append(version.GetVersionHeader());
41-
sb.Append("\n");
42-
43-
sb.Append(version.descriptionText);
44-
sb.Append("\n\n");
45-
46-
for (int j = 0; j < version.notes.Count; ++j) {
47-
ChangelogNoteEntry note = version.notes[j];
48-
49-
if (lastType != note.type) {
50-
if (lastType != (ChangelogEntryType)255)
51-
sb.Append("\n");
52-
lastType = note.type;
53-
lastScope = (ChangelogEntryScope)255;
54-
sb.Append("## ");
55-
sb.Append(note.type);
56-
sb.Append(": \n");
57-
}
58-
59-
if (lastScope != note.scope) {
60-
lastScope = note.scope;
61-
sb.Append("### ");
62-
sb.Append(note.scope);
63-
sb.Append(": \n");
64-
}
65-
66-
sb.Append(" * ");
67-
if(note.isCommunityFeedback)
68-
sb.Append("📢 ");
69-
sb.Append(note.text);
70-
sb.Append("\n");
71-
}
72-
73-
sb.Append("\n");
27+
versions[i].GetChangelog(ref sb);
7428
}
7529

7630
return sb.ToString();
7731
}
7832

33+
public string GetLastChangelogString() {
34+
StringBuilder sb = new StringBuilder();
35+
sb.Append("Note: 📢 indicates a change inspired by community feedback!\n");
36+
versions[versions.Count - 1].GetChangelog(ref sb);
37+
return sb.ToString();
38+
}
39+
40+
7941
#region Serialization
8042
const string SAVE_FILE_NOREZ = "ChangelogSettings";
8143
const string SAVE_FILE = "ChangelogSettings.json";
@@ -150,6 +112,40 @@ public string GetVersionHeader() {
150112

151113
return header;
152114
}
115+
116+
public void GetChangelog(ref StringBuilder sb) {
117+
ChangelogEntryType lastType = (ChangelogEntryType)255;
118+
ChangelogEntryScope lastScope = (ChangelogEntryScope)255;
119+
120+
sb.Append("\n\n---------- \n");
121+
sb.Append("# ");
122+
sb.Append(GetVersionHeader());
123+
sb.Append("\n");
124+
125+
sb.Append(descriptionText);
126+
sb.Append("\n");
127+
128+
for (int j = 0; j < notes.Count; ++j) {
129+
if (lastType != notes[j].type) {
130+
if (lastType != (ChangelogEntryType)255)
131+
sb.Append("\n");
132+
lastType = notes[j].type;
133+
lastScope = (ChangelogEntryScope)255;
134+
sb.Append("### ");
135+
sb.Append(notes[j].type);
136+
sb.Append(": \n");
137+
}
138+
139+
if (lastScope != notes[j].scope) {
140+
lastScope = notes[j].scope;
141+
sb.Append("#### ");
142+
sb.Append(notes[j].scope);
143+
sb.Append(": \n");
144+
}
145+
146+
notes[j].GetChangelog(ref sb);
147+
}
148+
}
153149
}
154150

155151
[Serializable]
@@ -158,6 +154,14 @@ public class ChangelogNoteEntry {
158154
public ChangelogEntryType type;
159155
public ChangelogEntryScope scope;
160156
public string text;
157+
158+
public void GetChangelog(ref StringBuilder sb) {
159+
sb.Append(" * ");
160+
if (isCommunityFeedback)
161+
sb.Append("📢 ");
162+
sb.Append(text);
163+
sb.Append("\n");
164+
}
161165
}
162166

163167
public enum ChangelogEntryType : byte {

0 commit comments

Comments
 (0)