-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.js
64 lines (44 loc) · 1.46 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const Config = require('cordova-config');
const path = require('path');
const { log } = require('./lib/utils')
const SOURCE_PATH = process.env['BITRISE_SOURCE_DIR'];
const CONFIG_FILE_PATH = process.env['config_path'] || 'config.xml'
const NAME = process.env['name'];
const ID = process.env['id'];
const VERSION = process.env['version'];
const ANDROID_VERSION_CODE = process.env['android_version_code'];
const ANDROID_PACKAGE_NAME = process.env['android_package_name'];
const IOS_BUNDLE_VERSION = process.env['ios_bundle_version'];
const IOS_BUNDLE_IDENTIFIER = process.env['ios_bundle_identifier'];
// Load and parse the config.xml
const config = new Config(path.join(SOURCE_PATH, CONFIG_FILE_PATH));
if (NAME) {
config.setName(NAME);
log('name', NAME);
}
if (ID) {
config.setID(ID);
log('id', ID);
}
if (VERSION) {
config.setVersion(VERSION);
log('version', VERSION);
}
if (ANDROID_VERSION_CODE) {
config.setAndroidVersionCode(ANDROID_VERSION_CODE);
log('android-versionCode', ANDROID_VERSION_CODE);
}
if (ANDROID_PACKAGE_NAME) {
config.setAndroidPackageName(ANDROID_PACKAGE_NAME);
log('android-packageName', ANDROID_PACKAGE_NAME);
}
if (IOS_BUNDLE_VERSION) {
config.setIOSBundleVersion(IOS_BUNDLE_VERSION);
log('ios-CFBundleVersion', IOS_BUNDLE_VERSION);
}
if (IOS_BUNDLE_IDENTIFIER) {
config.setIOSBundleIdentifier(IOS_BUNDLE_IDENTIFIER);
log('ios-CFBundleIdentifier', IOS_BUNDLE_IDENTIFIER);
}
// Write the config file
config.writeSync();