我转换了my-upload-key。密钥存储库到base64,并将内容导入到我的存储库秘密中的ANDROID_SIGNING_KEY。但是当我尝试运行CI/CD操作时,我得到这个错误。
> Keystore file '/home/runner/work/SampleApp/SampleApp/android/app/my-upload-key.keystore' not found for signing config 'release'.
my yml code:
- name: Sign APK
id: sign_app
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: android/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
/app/build.gradle
signingConfigs {
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
我知道我的上传密钥。keystore不应该上传到我的存储库,但问题是,为什么它需要这个文件,而我已经将其导入为base64 action secter?
解决方案:我从/app/build中删除了发布部分。Gradle和它工作。基本上,我们需要在运行签名作业之前创建一个未签名的发布。更新后的/app/build。它是:
signingConfigs {
// release {
// if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
// storeFile file(MYAPP_UPLOAD_STORE_FILE)
// storePassword MYAPP_UPLOAD_STORE_PASSWORD
// keyAlias MYAPP_UPLOAD_KEY_ALIAS
// keyPassword MYAPP_UPLOAD_KEY_PASSWORD
// }
// }
}
buildTypes {
release {
// signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}