@@ -32,7 +32,7 @@ fun main(args: Array<String>) {
32
32
exitProcess(1 )
33
33
}
34
34
35
- // TODO: verify git is clean
35
+ ensureCleanGitRepo(stoicDir)
36
36
37
37
println (" running test/regression-check.sh... (this will take a while)" )
38
38
check(ProcessBuilder (" $stoicDir /test/regression-check.sh" ).inheritIO().start().waitFor() == 0 )
@@ -58,15 +58,36 @@ fun main(args: Array<String>) {
58
58
59
59
versionFile.writeText(" $postReleaseVersion \n " )
60
60
61
+ val releaseTag = " v$releaseVersion "
61
62
println (
62
63
"""
64
+
65
+
66
+
67
+ Release version: $releaseVersion
68
+ Release tag: $releaseTag
63
69
Release prepared successfully: $releaseTar
64
70
Version incremented to: $postReleaseVersion
71
+
72
+
73
+ Next steps:
74
+
75
+ # Make sure you're in the right directory
76
+ cd $stoicDir
77
+
78
+ # tag the release and push it
79
+ git tag $releaseTag && git push origin $releaseTag
80
+
81
+ # Commit the version bump and push it
82
+ git add prebuild/STOIC_VERSION && git commit -m "$postReleaseVersion version bump" && git push
83
+
84
+ # Upload the release to Github
85
+ gh release create $releaseTag $releaseTar --title $releaseTag
86
+
87
+
88
+
65
89
""" .trimIndent()
66
90
)
67
- // TODO:
68
- // prompt the user to commit/push the changes to the version file and
69
- // upload the release
70
91
}
71
92
72
93
fun validateSemver (version : String ): Boolean =
@@ -77,3 +98,18 @@ fun incrementSemver(version: String): String {
77
98
val parts = clean.split(" ." ).map { it.toInt() }
78
99
return " ${parts[0 ]} .${parts[1 ]} .${parts[2 ] + 1 } -SNAPSHOT"
79
100
}
101
+
102
+ fun ensureCleanGitRepo (stoicDir : File ) {
103
+ val process = ProcessBuilder (" git" , " status" , " --porcelain" )
104
+ .directory(stoicDir)
105
+ .redirectErrorStream(true )
106
+ .start()
107
+
108
+ val output = process.inputStream.bufferedReader().readText().trim()
109
+ process.waitFor()
110
+
111
+ if (output.isNotEmpty()) {
112
+ System .err.println (" The git repository has uncommitted changes or untracked files. Aborting..." )
113
+ exitProcess(1 )
114
+ }
115
+ }
0 commit comments