-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathself_host_deploy.gradle
More file actions
30 lines (25 loc) · 986 Bytes
/
self_host_deploy.gradle
File metadata and controls
30 lines (25 loc) · 986 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
def releaseProperties = new Properties()
project.rootProject.file("release.properties").withInputStream { releaseProperties.load(it) }
def url = releaseProperties.getProperty("url")
def forceUpdate = releaseProperties.getProperty("forceUpdate")
def secret = "$System.env.DEPLOY_SECRET"
def apkFile = new String()
def outputDir = project.rootProject.file("outputs/")
if (outputDir.exists()) {
outputDir.eachFile {
println(it.name)
if (it.name.endsWith("release.apk")) {
apkFile = it.absolutePath
}
}
}
println("url : $url")
println("forceUpdate : $forceUpdate")
println("secret : $secret")
println("apkFile : $apkFile")
println("versionCode : $BuildConfig.versionCode")
task uploadApk(type: Exec) {
executable "/bin/sh"
args "-c",
"curl --location --request POST $url --header 'secret-key: $secret' -F 'apk=@$apkFile;type=application/vnd.android.package-archive' --form 'version_code=$BuildConfig.versionCode' --form 'is_force_update=$forceUpdate'"
}