Skip to content

Commit

Permalink
sign apk
Browse files Browse the repository at this point in the history
  • Loading branch information
mukilan committed Jul 7, 2024
1 parent 141a594 commit fd8d807
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:
RUSTC_WRAPPER: "sccache"
CCACHE: "sccache"
CARGO_INCREMENTAL: 0
APK_SIGNING_KEY_STORE_PATH: "servo_keystore.jks"

jobs:
build:
Expand Down Expand Up @@ -71,9 +72,18 @@ jobs:
id: setup-ndk
with:
ndk-version: r25c
- name: Setup Key Store for APK Signing
env:
KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}
run: |
echo "${KEYSTORE_BASE64}" > "${APK_SIGNING_KEY_STORE_PATH}"
ls -l
- name: Build (arch ${{ matrix.arch }} profile ${{ inputs.profile }})
env:
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
APK_SIGNING_KEY_STORE_PASS: ${{ secrets.APK_SIGNING_KEY_STORE_PASS }}
APK_SIGNING_KEY_ALIAS: ${{ secrets.APK_SIGNING_KEY_ALIAS }}
APK_SIGNING_KEY_PASS: ${{ secrets.APK_SIGNING_KEY_PASS }}
run: |
python3 ./mach build --use-crown --locked --android --target ${{ matrix.arch }} --${{ inputs.profile }}
cp -r target/cargo-timings target/cargo-timings-android-${{ matrix.arch }}
Expand Down
15 changes: 15 additions & 0 deletions support/android/apk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,18 @@ ext.getNdkDir = { ->
}
return ndkDir.absolutePath
}

ext.getSigningKeyInfo = { ->
def storeFilePath = System.getenv("APK_SIGNING_KEY_STORE_PATH")
def storeFile = storeFilePath ? new File(storeFilePath) : null
if (!storeFile || !storeFile.exists()) {
return null
} else {
return [
storeFile: storeFile,
storePassword: System.getenv("APK_SIGNING_KEY_STORE_PASS"),
keyAlias: System.getenv("APK_SIGNING_KEY_ALIAS"),
keyPassword: System.getenv("APK_SIGNING_KEY_PASS"),
]
}
}
15 changes: 14 additions & 1 deletion support/android/apk/servoapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,25 @@ android {
}


def signingKeyInfo = getSigningKeyInfo()

if (signingKeyInfo) {
signingConfigs {
release {
storeFile signingKeyInfo.storeFile
storePassword signingKeyInfo.storePassword
keyAlias signingKeyInfo.keyAlias
keyPassword signingKeyInfo.keyPassword
}
}
}

buildTypes {
debug {
}

release {
signingConfig signingConfigs.debug // Change this to sign with a production key
signingConfig signingKeyInfo ? signingConfigs.release : signingConfigs.debug
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
Expand Down

0 comments on commit fd8d807

Please sign in to comment.