@@ -3,6 +3,7 @@ package com.squareup.stoic.preparerelease
3
3
import com.squareup.stoic.bridge.versionCodeFromVersionName
4
4
5
5
import java.io.File
6
+ import java.lang.ProcessBuilder.Redirect
6
7
import kotlin.system.exitProcess
7
8
8
9
fun main (args : Array <String >) {
@@ -34,30 +35,48 @@ fun main(args: Array<String>) {
34
35
35
36
ensureCleanGitRepo(stoicDir)
36
37
37
- println (" running test/regression-check.sh... (this will take a while)" )
38
- check(ProcessBuilder (" $stoicDir /test/regression-check.sh" ).inheritIO().start().waitFor() == 0 )
39
- println (" ... test/regression-check.sh completed successfully." )
40
-
41
- println (" building clean..." )
38
+ println (" Removing $stoicDir /out to ensure clean build..." )
42
39
check(ProcessBuilder (" rm" , " -r" , " $stoicDir /out" ).inheritIO().start().waitFor() == 0 )
43
- check(ProcessBuilder (" $stoicDir /build.sh" ).inheritIO().start().waitFor() == 0 )
44
- println (" ... done building clean." )
45
-
46
- println (" preparing tar archive..." )
47
- check(
48
- ProcessBuilder (
49
- " tar" ,
50
- " --create" ,
51
- " --gzip" ,
52
- " --file=${releaseTar.absolutePath} " ,
53
- " --directory=${outRelDir.absolutePath} " ,
54
- " ."
55
- ).inheritIO().start().waitFor() == 0
56
- )
57
- println (" ... done preparing tar archive." )
58
40
41
+ println (" Updating ${versionFile.absolutePath} to $releaseVersion " )
42
+ versionFile.writeText(" $releaseVersion \n " )
43
+ try {
44
+ println (" running test/clean-build-and-regression-check.sh... (this will take a while)" )
45
+ check(
46
+ ProcessBuilder (
47
+ " $stoicDir /test/clean-build-and-regression-check.sh"
48
+ ).inheritIO().start().waitFor() == 0
49
+ )
50
+ println (" ... test/clean-build-and-regression-check.sh completed successfully." )
51
+
52
+ println (" preparing tar archive..." )
53
+ check(
54
+ ProcessBuilder (
55
+ " tar" ,
56
+ " --create" ,
57
+ " --gzip" ,
58
+ " --file=${releaseTar.absolutePath} " ,
59
+ " --directory=${outRelDir.absolutePath} " ,
60
+ " ."
61
+ ).inheritIO().start().waitFor() == 0
62
+ )
63
+ println (" ... done preparing tar archive." )
64
+ } catch (e: Throwable ) {
65
+ println (" Restoring ${versionFile.absolutePath} to $currentVersion due to failure" )
66
+ versionFile.writeText(" $currentVersion \n " )
67
+ throw e
68
+ }
69
+
70
+ println (" Updating ${versionFile.absolutePath} to $postReleaseVersion " )
59
71
versionFile.writeText(" $postReleaseVersion \n " )
60
72
73
+ val sha256sum = ProcessBuilder (" sha256sum" , releaseTar.absolutePath)
74
+ .inheritIO()
75
+ .redirectOutput(Redirect .PIPE )
76
+ .start()
77
+ .also { check(it.waitFor() == 0 ) }
78
+ .inputReader().readText().trim()
79
+
61
80
val releaseTag = " v$releaseVersion "
62
81
println (
63
82
"""
@@ -84,6 +103,11 @@ fun main(args: Array<String>) {
84
103
# Upload the release to Github
85
104
gh release create $releaseTag $releaseTar --title $releaseTag
86
105
106
+ # Update the release in https://github.com/block/homebrew-tap
107
+ # The sha256sum for this release is $sha256sum
108
+ # The URL should be:
109
+ # https://github.com/block/stoic/releases/download/v$releaseVersion /stoic-$releaseVersion .tar.gz
110
+ # (verify that after uploading to github)
87
111
88
112
89
113
""" .trimIndent()
0 commit comments