@@ -1196,16 +1196,36 @@ task gitAddReleaseFilesToStaging(type: Exec, dependsOn: releasePlugin) {
11961196 commandLine " git" , " add" , " -A"
11971197}
11981198
1199+ /*
1200+ * Read the changes applied to the current version from the changelog.
1201+ *
1202+ * @returns Version summary in a multiline string.
1203+ */
1204+ String readVersionSummaryFromChangelog () {
1205+ String versionSummary = " "
1206+ for (String line in project. ext. changelog. text. split(" \n " )) {
1207+ String trimmedLine = line. trim()
1208+ if (line. isEmpty()) break
1209+ versionSummary + = line + " \n "
1210+ }
1211+ return versionSummary
1212+ }
1213+
1214+ /*
1215+ * Create a commit message for a release commit.
1216+ *
1217+ * @returns Commit message string.
1218+ */
1219+ String createCommitMessage () {
1220+ return sprintf (" Version %s\n\n %s" ,
1221+ project. ext. pluginVersionSemVer,
1222+ readVersionSummaryFromChangelog())
1223+ }
1224+
11991225task gitCreateReleaseCommit (dependsOn : gitAddReleaseFilesToStaging) {
12001226 description " Run git to create a release commit."
12011227
12021228 doLast {
1203- String versionSummary = " "
1204- for (String line in project. ext. changelog. text. split(" \n " )) {
1205- String trimmedLine = line. trim()
1206- if (line. isEmpty()) break
1207- versionSummary + = line + " \n "
1208- }
12091229 def stdout = new ByteArrayOutputStream ()
12101230 exec {
12111231 commandLine " git" , " status" , " -s"
@@ -1214,10 +1234,7 @@ task gitCreateReleaseCommit(dependsOn: gitAddReleaseFilesToStaging) {
12141234 }
12151235 if (! stdout. toString(). isEmpty()) {
12161236 exec {
1217- commandLine " git" , " commit" , " -a" , " -m" ,
1218- sprintf (" Version %s\n\n %s" ,
1219- project. ext. pluginVersionSemVer,
1220- versionSummary)
1237+ commandLine " git" , " commit" , " -a" , " -m" , createCommitMessage()
12211238 }
12221239 }
12231240 }
@@ -1228,7 +1245,13 @@ task gitTagRelease(type: Exec, dependsOn: gitCreateReleaseCommit) {
12281245 " *after* a release commit has been be created." )
12291246 commandLine " git" , " tag" , " -a" ,
12301247 sprintf (" v%s" , pluginVersionSemVer), " -m" ,
1231- sprintf (" release %s" , pluginVersionSemVer)
1248+ sprintf (" %s\n\n Download [here](%s)" ,
1249+ createCommitMessage(),
1250+ sprintf (" https://github.com/googlesamples/" +
1251+ " unity-jar-resolver/raw/v%s/" +
1252+ " play-services-resolver-%s.unitypackage" ,
1253+ project. ext. pluginVersionSemVer,
1254+ project. ext. pluginVersion))
12321255}
12331256
12341257// TODO: Version Handler tests to implement in both batch and interactive modes
0 commit comments