Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make iOS update commands run in sequence instead of all at once #2024

Merged
merged 4 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions .github/actions/bumpVersion/bumpVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,18 @@ function updateNativeVersions(version) {
});

// Update iOS
updateiOSVersion(version)
.then((promiseValues) => {
// The first promiseValue will be the CFBundleVersion, so confirm it has 4 parts before setting the env var
const cfBundleVersion = promiseValues[0];
if (_.isString(cfBundleVersion) && cfBundleVersion.split('.').length === 4) {
core.setOutput('NEW_IOS_VERSION', cfBundleVersion);
console.log('Successfully updated iOS!');
} else {
core.setFailed(`Failed to set NEW_IOS_VERSION. CFBundleVersion: ${cfBundleVersion}`);
}
})
.catch((err) => {
console.error('Error updating iOS');
core.setFailed(err);
});
try {
const cfBundleVersion = updateiOSVersion(version);
if (_.isString(cfBundleVersion) && cfBundleVersion.split('.').length === 4) {
core.setOutput('NEW_IOS_VERSION', cfBundleVersion);
console.log('Successfully updated iOS!');
} else {
core.setFailed(`Failed to set NEW_IOS_VERSION. CFBundleVersion: ${cfBundleVersion}`);
}
} catch (err) {
console.error('Error updating iOS');
core.setFailed(err);
}
}

const octokit = github.getOctokit(core.getInput('GITHUB_TOKEN', {required: true}));
Expand Down
48 changes: 22 additions & 26 deletions .github/actions/bumpVersion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,18 @@ function updateNativeVersions(version) {
});

// Update iOS
updateiOSVersion(version)
.then((promiseValues) => {
// The first promiseValue will be the CFBundleVersion, so confirm it has 4 parts before setting the env var
const cfBundleVersion = promiseValues[0];
if (_.isString(cfBundleVersion) && cfBundleVersion.split('.').length === 4) {
core.setOutput('NEW_IOS_VERSION', cfBundleVersion);
console.log('Successfully updated iOS!');
} else {
core.setFailed(`Failed to set NEW_IOS_VERSION. CFBundleVersion: ${cfBundleVersion}`);
}
})
.catch((err) => {
console.error('Error updating iOS');
core.setFailed(err);
});
try {
const cfBundleVersion = updateiOSVersion(version);
if (_.isString(cfBundleVersion) && cfBundleVersion.split('.').length === 4) {
core.setOutput('NEW_IOS_VERSION', cfBundleVersion);
console.log('Successfully updated iOS!');
} else {
core.setFailed(`Failed to set NEW_IOS_VERSION. CFBundleVersion: ${cfBundleVersion}`);
}
} catch (err) {
console.error('Error updating iOS');
core.setFailed(err);
}
}

const octokit = github.getOctokit(core.getInput('GITHUB_TOKEN', {required: true}));
Expand Down Expand Up @@ -104,8 +101,7 @@ octokit.repos.listTags({
/***/ 322:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {

const {promisify} = __nccwpck_require__(1669);
const exec = promisify(__nccwpck_require__(3129).exec);
const {execSync} = __nccwpck_require__(3129);
const fs = __nccwpck_require__(5747).promises;
const path = __nccwpck_require__(5622);
const getMajorVersion = __nccwpck_require__(6688);
Expand Down Expand Up @@ -180,21 +176,21 @@ exports.updateAndroidVersion = function updateAndroidVersion(versionName, versio
* Updates the CFBundleShortVersionString and the CFBundleVersion.
*
* @param {String} version
* @returns {Promise}
* @returns {String}
*/
exports.updateiOSVersion = function updateiOSVersion(version) {
const shortVersion = version.split('-')[0];
const cfVersion = version.includes('-') ? version.replace('-', '.') : `${version}.0`;
console.log('Updating iOS', `CFBundleShortVersionString: ${shortVersion}`, `CFBundleVersion: ${cfVersion}`);

// Pass back the cfVersion in the return array so we can set the NEW_IOS_VERSION in ios.yml
return Promise.all([
cfVersion,
exec(`/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${shortVersion}" ${PLIST_PATH}`),
exec(`/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${shortVersion}" ${PLIST_PATH_TEST}`),
exec(`/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${cfVersion}" ${PLIST_PATH}`),
exec(`/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${cfVersion}" ${PLIST_PATH_TEST}`),
]);
// Update Plists
execSync(`/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${shortVersion}" ${PLIST_PATH}`);
execSync(`/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${shortVersion}" ${PLIST_PATH_TEST}`);
execSync(`/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${cfVersion}" ${PLIST_PATH}`);
execSync(`/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${cfVersion}" ${PLIST_PATH_TEST}`);

// Return the cfVersion so we can set the NEW_IOS_VERSION in ios.yml
return cfVersion;
};


Expand Down
21 changes: 10 additions & 11 deletions .github/libs/nativeVersionUpdater.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const {promisify} = require('util');
const exec = promisify(require('child_process').exec);
const {execSync} = require('child_process');
const fs = require('fs').promises;
const path = require('path');
const getMajorVersion = require('semver/functions/major');
Expand Down Expand Up @@ -74,19 +73,19 @@ exports.updateAndroidVersion = function updateAndroidVersion(versionName, versio
* Updates the CFBundleShortVersionString and the CFBundleVersion.
*
* @param {String} version
* @returns {Promise}
* @returns {String}
*/
exports.updateiOSVersion = function updateiOSVersion(version) {
const shortVersion = version.split('-')[0];
const cfVersion = version.includes('-') ? version.replace('-', '.') : `${version}.0`;
console.log('Updating iOS', `CFBundleShortVersionString: ${shortVersion}`, `CFBundleVersion: ${cfVersion}`);

// Pass back the cfVersion in the return array so we can set the NEW_IOS_VERSION in ios.yml
return Promise.all([
cfVersion,
exec(`/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${shortVersion}" ${PLIST_PATH}`),
exec(`/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${shortVersion}" ${PLIST_PATH_TEST}`),
exec(`/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${cfVersion}" ${PLIST_PATH}`),
exec(`/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${cfVersion}" ${PLIST_PATH_TEST}`),
]);
// Update Plists
execSync(`/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${shortVersion}" ${PLIST_PATH}`);
execSync(`/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${shortVersion}" ${PLIST_PATH_TEST}`);
execSync(`/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${cfVersion}" ${PLIST_PATH}`);
execSync(`/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${cfVersion}" ${PLIST_PATH_TEST}`);

// Return the cfVersion so we can set the NEW_IOS_VERSION in ios.yml
return cfVersion;
};