Skip to content

Commit

Permalink
ci: fix unable to read secrets
Browse files Browse the repository at this point in the history
grant exec permission to gradlew
  • Loading branch information
BinTianqi committed May 25, 2024
1 parent acf3cb6 commit 67d00af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
- name: Get short commit SHA
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV

- name: Grant execution permission to Gradle Wrapper
run: chmod +x gradlew

- name: Build APK (testkey)
run: ./gradlew build

Expand All @@ -43,14 +40,14 @@ jobs:

- name: Export key
env:
KEY_BASE64: ${{ secret.KEY_BASE64 }}
KEY_BASE64: ${{ secrets.KEY_BASE64 }}
run: echo $KEY_BASE64 | base64 --decode - > app/signature.jks

- name: Build APK
env:
KEYSTORE_PASSWORD: ${{ secret.KEYSTORE_PASSWORD }}
KEY_PASSWORD: ${{ secret.KEY_PASSWORD }}
KEY_ALIAS: ${{ secret.KEY_ALIAS }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
run: ./gradlew build

- name: Upload Debug APK
Expand Down
15 changes: 6 additions & 9 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ var keyAlias: String? = null

android {
signingConfigs {
create("testkey") {
create("defaultSignature") {
storeFile = file("signature.jks")
storePassword = keystorePassword ?: "testkey"
keyPassword = keyPassword ?: "testkey"
keyAlias = keyAlias ?: "testkey"
storePassword = System.getenv("KEYSTORE_PASSWORD") ?: "testkey"
keyPassword = System.getenv("KEY_PASSWORD") ?: "testkey"
keyAlias = System.getenv("KEY_ALIAS") ?: "testkey"
}
}
namespace = "com.bintianqi.owndroid"
Expand All @@ -39,10 +39,10 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("testkey")
signingConfig = signingConfigs.getByName("defaultSignature")
}
debug {
signingConfig = signingConfigs.getByName("testkey")
signingConfig = signingConfigs.getByName("defaultSignature")
}
}
compileOptions {
Expand Down Expand Up @@ -86,9 +86,6 @@ tasks.register("prepareSignature") {
file("signature.jks").let {
if(!it.exists()) file("testkey.jks").copyTo(it)
}
keystorePassword = System.getenv("KEYSTORE_PASSWORD")
keyAlias = System.getenv("KEY_ALIAS")
keyPassword = System.getenv("KEY_PASSWORD")
}
}

Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.

0 comments on commit 67d00af

Please sign in to comment.