23 lines
1.2 KiB
JavaScript
23 lines
1.2 KiB
JavaScript
|
|
const { withAppBuildGradle } = require('expo/config-plugins');
|
||
|
|
module.exports = config => withAppBuildGradle(config, cfg => {
|
||
|
|
let source = cfg.modResults.contents;
|
||
|
|
if (source.includes('// CMVR production signing')) return cfg;
|
||
|
|
source = source.replace(/android\s*\{/, `android {
|
||
|
|
// CMVR production signing: secrets are supplied only to the build process.
|
||
|
|
signingConfigs {
|
||
|
|
cmvrRelease {
|
||
|
|
def required = ['CMVR_KEYSTORE', 'CMVR_STORE_PASSWORD', 'CMVR_KEY_ALIAS', 'CMVR_KEY_PASSWORD']
|
||
|
|
required.each { if (!System.getenv(it)) throw new GradleException('Missing production signing variable: ' + it) }
|
||
|
|
storeFile file(System.getenv('CMVR_KEYSTORE'))
|
||
|
|
storePassword System.getenv('CMVR_STORE_PASSWORD')
|
||
|
|
keyAlias System.getenv('CMVR_KEY_ALIAS')
|
||
|
|
keyPassword System.getenv('CMVR_KEY_PASSWORD')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
`);
|
||
|
|
const release = /(release\s*\{[\s\S]*?signingConfig\s+)signingConfigs\.debug/;
|
||
|
|
if (!release.test(source)) throw Error('Unknown Expo release signing template; refusing a production debug-signed APK');
|
||
|
|
cfg.modResults.contents = source.replace(release, '$1signingConfigs.cmvrRelease');
|
||
|
|
return cfg;
|
||
|
|
});
|