forked from PaulWoitaschek/Voice
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrelease.main.kts
More file actions
executable file
·36 lines (30 loc) · 897 Bytes
/
release.main.kts
File metadata and controls
executable file
·36 lines (30 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env kotlin
@file:DependsOn("com.github.ajalt:clikt:2.6.0")
import com.github.ajalt.clikt.core.CliktCommand
import java.io.File
class Release : CliktCommand() {
override fun run() {
execute("./gradlew", "app:bundleRelease")
val appVersion = appVersion()
val releaseFolder = File("releases", appVersion)
releaseFolder.mkdirs()
File("app/build/outputs/bundle/release/app-release.aab")
.copyTo(File(releaseFolder, "app.aab"))
}
private fun appVersion(): String {
return File("buildSrc/src/main/kotlin/deps/Deps.kt")
.readLines()
.mapNotNull {
"versionName = \"(.*)\"".toRegex().find(it)?.groupValues?.getOrNull(1)
}
.single()
}
private fun execute(vararg command: String) {
ProcessBuilder(*command)
.inheritIO()
.start()
.waitFor()
.also { check(it == 0) }
}
}
Release().main(args)