Skip to content

Instantly share code, notes, and snippets.

@kotano
Last active August 17, 2023 10:54
Show Gist options
  • Save kotano/c5b6e81e22274ee88900cabed89dd6ff to your computer and use it in GitHub Desktop.
Save kotano/c5b6e81e22274ee88900cabed89dd6ff to your computer and use it in GitHub Desktop.
appcenter

Codepush config

AppsList

appcenter apps list
dev_pg/LK-Android
dev_pg/LK-iOS
dev_pg/MF-Android
IlyaEzy/LK-Android
IlyaEzy/LK-iOS
IlyaEzy/MF-Android
IlyaEzy/MF-iOS
IlyaEzy/PF-Android
IlyaEzy/PF-iOS

App versions

LK 2.12.0 MF 3.12.0 PF 2.10.0

Stage

yarn stage-config
appcenter codepush release-react -a APPNAME -d Staging -t ## -m

Production

yarn prod-config
appcenter codepush release-react -a APPNAME -d Production -t ##

Example

appcenter codepush release-react -a dev_pg/LK-iOS -d Staging -t 2.10.0 -m

LK

appcenter codepush release-react -a IlyaEzy/LK-iOS -d Staging -t 2.12.1 -m
appcenter codepush release-react -a IlyaEzy/LK-Android -d Staging -t 2.12.1 -m

appcenter codepush release-react -a IlyaEzy/LK-iOS -d Production -t 2.12.0
appcenter codepush release-react -a IlyaEzy/LK-Android -d Production -t 2.12.0

appcenter codepush deployment list --app IlyaEzy/LK-Android
appcenter codepush deployment list --app IlyaEzy/LK-iOS

appcenter codepush rollback -a IlyaEzy/LK-iOS Production --target-release v34
appcenter codepush rollback -a IlyaEzy/LK-Android Production --target-release v34

MF

appcenter codepush release-react -a IlyaEzy/MF-iOS -d Staging -t ^3.10.0 -m
appcenter codepush release-react -a IlyaEzy/MF-Android -d Staging -t ^3.10.0 -m

appcenter codepush release-react -a IlyaEzy/MF-iOS -d Production -t 3.13.0
appcenter codepush release-react -a IlyaEzy/MF-Android -d Production -t 3.13.0

appcenter codepush deployment list --app IlyaEzy/MF-Android
appcenter codepush deployment list --app IlyaEzy/MF-iOS

PF

appcenter codepush release-react -a IlyaEzy/PF-iOS -d Staging -t ^2.10.0 -m
appcenter codepush release-react -a IlyaEzy/PF-Android -d Staging -t ^2.10.0 -m

appcenter codepush release-react -a IlyaEzy/PF-iOS -d Production -t 2.11.0
appcenter codepush release-react -a IlyaEzy/PF-Android -d Production -t 2.11.0

appcenter codepush deployment list --app IlyaEzy/PF-Android
appcenter codepush deployment list --app IlyaEzy/PF-iOS

See all deployments

appcenter codepush deployment list --app IlyaEzy/LK-Android
appcenter codepush deployment list --app IlyaEzy/LK-iOS
appcenter codepush deployment list --app IlyaEzy/MF-Android
appcenter codepush deployment list --app IlyaEzy/MF-iOS
appcenter codepush deployment list --app IlyaEzy/PF-Android
appcenter codepush deployment list --app IlyaEzy/PF-iOS
#!/usr/bin/env node
const { spawn } = require('child_process');
const fs = require('fs');
const inquirer = require('inquirer');
const apps = {
LK: {
iOS: {
staging: 'IlyaEzy/LK-iOS',
production: 'IlyaEzy/LK-iOS',
},
android: {
staging: 'IlyaEzy/LK-Android',
production: 'IlyaEzy/LK-Android',
},
},
MF: {
iOS: {
staging: 'IlyaEzy/MF-iOS',
production: 'IlyaEzy/MF-iOS',
},
android: {
staging: 'IlyaEzy/MF-Android',
production: 'IlyaEzy/MF-Android',
},
},
PF: {
iOS: {
staging: 'IlyaEzy/PF-iOS',
production: 'IlyaEzy/PF-iOS',
},
android: {
staging: 'IlyaEzy/PF-Android',
production: 'IlyaEzy/PF-Android',
},
},
};
const environments = {
staging: 'dev',
production: 'prod',
};
const copyFile = function (who, where) {
fs.copyFile(who, where, (err) => {
if (err) {
throw err;
}
console.log(`${who} was copied`);
});
};
inquirer
.prompt([
{
type: 'list',
name: 'environment',
message: 'Select an environment:',
choices: ['staging', 'production'],
},
{
type: 'list',
name: 'app',
message: 'Select an app:',
choices: ['LK', 'MF', 'PF'],
},
{
type: 'list',
name: 'platform',
message: 'Select a platform:',
choices: ['iOS', 'android'],
},
{
type: 'input',
name: 'version',
message: 'Enter the version number:',
},
{
type: 'confirm',
name: 'mandatory',
message: 'Make this release mandatory?',
default: false,
},
])
.then((answers) => {
const { environment, app, platform, version, mandatory } = answers;
copyFile(`config/constants_${environments[environment]}.js`, 'src/config/index.js');
// android appcenter configs
copyFile(
`config/android/strings_${environments[environment]}.xml`,
'android/app/src/main/res/values/strings.xml',
);
// ios appcenter configs
copyFile(`config/ios/Info_${environments[environment]}.plist`, 'ios/MFood/Info.plist');
const appSlug = apps[app][platform][environment.toLowerCase()];
const command = `appcenter codepush release-react -a ${appSlug} -d ${environment} -t ${version} ${
mandatory ? '--mandatory' : ''
}`;
const child = spawn(command, { shell: true });
child.stdout.on('data', (data) => {
console.log(data.toString());
});
child.stderr.on('data', (data) => {
console.error(data.toString());
});
child.on('exit', (code) => {
console.log(`Child process exited with code ${code}`);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment