Skip to content

Commit 6f97155

Browse files
committed
Releases should not end in SNAPSHOT
1 parent 5af9d58 commit 6f97155

File tree

3 files changed

+81
-55
lines changed

3 files changed

+81
-55
lines changed

kotlin/internal/tool/prepare-release/src/main/java/com/squareup/stoic/preparerelease/Main.kt

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.squareup.stoic.preparerelease
33
import com.squareup.stoic.bridge.versionCodeFromVersionName
44

55
import java.io.File
6+
import java.lang.ProcessBuilder.Redirect
67
import kotlin.system.exitProcess
78

89
fun main(args: Array<String>) {
@@ -34,30 +35,48 @@ fun main(args: Array<String>) {
3435

3536
ensureCleanGitRepo(stoicDir)
3637

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...")
4239
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.")
5840

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")
5971
versionFile.writeText("$postReleaseVersion\n")
6072

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+
6180
val releaseTag = "v$releaseVersion"
6281
println(
6382
"""
@@ -84,6 +103,11 @@ fun main(args: Array<String>) {
84103
# Upload the release to Github
85104
gh release create $releaseTag $releaseTar --title $releaseTag
86105
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)
87111
88112
89113
""".trimIndent()
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
4+
# This script should be run before pushing to main - all errors must be addressed
5+
6+
script_dir="$(dirname "$(readlink -f "$0")")"
7+
8+
# To ensure stability, we always build clean
9+
rm -rf "$script_dir/../out"
10+
(cd "$script_dir/../kotlin" && ./gradlew clean)
11+
"$script_dir/../build.sh"
12+
13+
if [ "$(realpath "$(which stoic)")" != "$(realpath "$script_dir/../out/rel/bin/stoic")" ]; then
14+
echo stoic resolves to "$(which stoic)" - not the one we just built
15+
exit 1
16+
fi
17+
18+
"$script_dir"/shellcheck.sh
19+
"$script_dir"/test-shell.sh
20+
"$script_dir"/test-demo-app-without-sdk.sh
21+
"$script_dir"/test-setup.sh
22+
23+
# TODO: these tests require functionality not available on older versions of
24+
# Android
25+
# "$script_dir/../out/rel/bin/stoic" testsuite
26+
27+
# TODO
28+
#"$script_dir"/test-shebang.sh
29+
30+
31+
set +x
32+
echo
33+
echo
34+
echo All checks completed successfully
35+
echo
36+
echo

test/regression-check.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

test/regression-check.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
clean-build-and-regression-check.sh

0 commit comments

Comments
 (0)