Add config plugin to persist release signing configuration
This commit is contained in:
@@ -54,7 +54,8 @@
|
|||||||
],
|
],
|
||||||
"./plugins/withKioskAdmin",
|
"./plugins/withKioskAdmin",
|
||||||
"./plugins/withUsbCamera",
|
"./plugins/withUsbCamera",
|
||||||
"./plugins/withLocalAars"
|
"./plugins/withLocalAars",
|
||||||
|
"./withAndroidSigning"
|
||||||
],
|
],
|
||||||
"extra": {
|
"extra": {
|
||||||
"eas": {
|
"eas": {
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
const { withAppBuildGradle } = require('@expo/config-plugins');
|
||||||
|
|
||||||
|
module.exports = function withAndroidSigning(config) {
|
||||||
|
return withAppBuildGradle(config, (config) => {
|
||||||
|
if (config.modResults.language === 'groovy') {
|
||||||
|
let buildGradle = config.modResults.contents;
|
||||||
|
|
||||||
|
const signingConfig = `
|
||||||
|
release {
|
||||||
|
if (project.hasProperty('SCHNAPPIX_RELEASE_STORE_FILE')) {
|
||||||
|
storeFile file("../../" + SCHNAPPIX_RELEASE_STORE_FILE)
|
||||||
|
storePassword SCHNAPPIX_RELEASE_STORE_PASSWORD
|
||||||
|
keyAlias SCHNAPPIX_RELEASE_KEY_ALIAS
|
||||||
|
keyPassword SCHNAPPIX_RELEASE_KEY_PASSWORD
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
if (!buildGradle.includes('SCHNAPPIX_RELEASE_STORE_FILE')) {
|
||||||
|
// Inject inside signingConfigs { ... }
|
||||||
|
buildGradle = buildGradle.replace(
|
||||||
|
/signingConfigs\s*\{([\s\S]*?)debug\s*\{([\s\S]*?)\}/,
|
||||||
|
`signingConfigs {$1debug {$2}\n${signingConfig}`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Change buildTypes release to use signingConfigs.release
|
||||||
|
buildGradle = buildGradle.replace(
|
||||||
|
/signingConfig signingConfigs\.debug/g,
|
||||||
|
`signingConfig signingConfigs.release`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
config.modResults.contents = buildGradle;
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
});
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user