@@ -1196,16 +1196,36 @@ task gitAddReleaseFilesToStaging(type: Exec, dependsOn: releasePlugin) {
1196
1196
commandLine " git" , " add" , " -A"
1197
1197
}
1198
1198
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
+
1199
1225
task gitCreateReleaseCommit (dependsOn : gitAddReleaseFilesToStaging) {
1200
1226
description " Run git to create a release commit."
1201
1227
1202
1228
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
- }
1209
1229
def stdout = new ByteArrayOutputStream ()
1210
1230
exec {
1211
1231
commandLine " git" , " status" , " -s"
@@ -1214,10 +1234,7 @@ task gitCreateReleaseCommit(dependsOn: gitAddReleaseFilesToStaging) {
1214
1234
}
1215
1235
if (! stdout. toString(). isEmpty()) {
1216
1236
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()
1221
1238
}
1222
1239
}
1223
1240
}
@@ -1228,7 +1245,13 @@ task gitTagRelease(type: Exec, dependsOn: gitCreateReleaseCommit) {
1228
1245
" *after* a release commit has been be created." )
1229
1246
commandLine " git" , " tag" , " -a" ,
1230
1247
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))
1232
1255
}
1233
1256
1234
1257
// TODO: Version Handler tests to implement in both batch and interactive modes
0 commit comments