Skip to content

Commit aad23a2

Browse files
committed
Add changelog and readme to ,git directory
1 parent 00e8561 commit aad23a2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Editor/BuildManager/BuildPipeline/BuildManager.cs

+32
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ static void PostBuild(BuildSequence sequence) {
101101
string changelogContent = "";
102102
string readmeContent = usedChangelog.readme;
103103

104+
bool isAnyReleaseBuild = false;
105+
104106
if (isNeedChangelogFile) {
105107
StringBuilder sb = new StringBuilder();
106108

@@ -161,6 +163,8 @@ static void PostBuild(BuildSequence sequence) {
161163

162164
if (!string.IsNullOrEmpty(buildsPath[i])) {
163165
if (sequence.builds[i].isReleaseBuild) { //Destroy IL2CPP junk after build
166+
isAnyReleaseBuild = true;
167+
164168
string buildRootPath = Path.GetDirectoryName(buildsPath[i]);
165169
string[] dirs = Directory.GetDirectories(buildRootPath);
166170
var il2cppDirs = dirs.Where(s => s.Contains("BackUpThisFolder_ButDontShipItWithYourGame"));
@@ -205,6 +209,34 @@ static void PostBuild(BuildSequence sequence) {
205209
}
206210
}
207211
}
212+
213+
if (isAnyReleaseBuild) {
214+
string gitRootPath = Path.Combine(Application.dataPath, "..");
215+
216+
if(!Directory.Exists(Path.Combine(gitRootPath, ".git"))) {
217+
gitRootPath = Path.Combine(gitRootPath, "..");
218+
219+
if (!Directory.Exists(Path.Combine(gitRootPath, ".git"))) {
220+
gitRootPath = null;
221+
}
222+
}
223+
224+
if(gitRootPath != null) {
225+
if (isNeedChangelogFile) {
226+
File.WriteAllText(
227+
Path.Combine(gitRootPath, "Changelog.md"),
228+
changelogContent
229+
);
230+
}
231+
232+
if (isNeedReadmeFile) {
233+
File.WriteAllText(
234+
Path.Combine(gitRootPath, "ReadmeGame.md"),
235+
readmeContent
236+
);
237+
}
238+
}
239+
}
208240
}
209241

210242
static void Compress(BuildSequence sequence) {

0 commit comments

Comments
 (0)