Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit 57378f8

Browse files
committed
chore: use bash script to download signing key
1 parent def9704 commit 57378f8

File tree

2 files changed

+42
-16
lines changed

2 files changed

+42
-16
lines changed

.tools/download_key.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
dest=$1
6+
url=$2
7+
user=$3
8+
pass=$4
9+
10+
if [ "$dest" == "" ]; then
11+
echo "Please specify destination file"
12+
exit 1
13+
fi
14+
15+
if [ "$url" == "" ]; then
16+
echo "Please specify signing key URL"
17+
exit 1
18+
fi
19+
20+
if [ "$user" == "" ]; then
21+
echo "Please specify auth user"
22+
exit 1
23+
fi
24+
25+
if [ "$pass" == "" ]; then
26+
echo "Please specify auth password"
27+
exit 1
28+
fi
29+
30+
if [ -f "$dest" ]; then
31+
echo "Skipping signing key download as $dest already exists"
32+
exit 0
33+
fi
34+
35+
# Download silently to prevent URL/user/pass being exposed
36+
curl -s -u "$user:$pass" --output "$dest" $url

app/build.gradle.kts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
@file:Suppress("UnstableApiUsage")
22

3-
import de.undercouch.gradle.tasks.download.DownloadAction
4-
53
plugins {
64
id("com.android.application")
75
id("kotlin-android")
86
id("kotlin-kapt")
97
id("kotlin-parcelize")
108
id("com.google.android.gms.oss-licenses-plugin")
11-
id("de.undercouch.download") version "5.3.0"
129
}
1310

1411
android {
@@ -167,19 +164,12 @@ fun downloadSigningKey() {
167164
val pass = getEnvOrProp(AUTH_PASS) ?: return
168165

169166
logger.info("Downloading signing key...")
170-
DownloadAction(project).apply {
171-
src(url)
172-
dest(signingKey)
173-
username(user)
174-
password(pass)
175-
overwrite(false)
176-
177-
// Must be set to true
178-
quiet(true)
179-
}.execute()
180-
181-
// wait for the download to finish
182-
.get()
167+
val result = exec {
168+
workingDir(rootProject.projectDir)
169+
commandLine("bash", "./.tools/download_key.sh", signingKey.absolutePath, url, user, pass)
170+
}
171+
172+
result.assertNormalExitValue()
183173
}
184174

185175
fun getEnvOrProp(key: String): String? {

0 commit comments

Comments
 (0)