From a252e099d46b9eb6239f548177b376fef00d8156 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Tue, 23 Mar 2021 15:12:31 -0700 Subject: [PATCH 1/4] Make iOS update commands run in sequence instead of all at once --- .github/libs/nativeVersionUpdater.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/libs/nativeVersionUpdater.js b/.github/libs/nativeVersionUpdater.js index fdcb81f58425..b9b1ecb15193 100644 --- a/.github/libs/nativeVersionUpdater.js +++ b/.github/libs/nativeVersionUpdater.js @@ -82,11 +82,16 @@ exports.updateiOSVersion = function updateiOSVersion(version) { 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, + const updatePromise = [ 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}`), + ] + .reduce((previousPromise, currentPromise) => previousPromise.then(() => currentPromise()), Promise.resolve()); + + return Promise.all([ + cfVersion, + updatePromise, ]); }; From 702ed9f9172c6cf3794fb05c1da4393ed9490575 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Tue, 23 Mar 2021 15:18:48 -0700 Subject: [PATCH 2/4] Rebuild GH actions --- .github/actions/bumpVersion/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/actions/bumpVersion/index.js b/.github/actions/bumpVersion/index.js index 1443315c1480..a12af4713a20 100644 --- a/.github/actions/bumpVersion/index.js +++ b/.github/actions/bumpVersion/index.js @@ -188,12 +188,17 @@ exports.updateiOSVersion = function updateiOSVersion(version) { 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, + const updatePromise = [ 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}`), + ] + .reduce((previousPromise, currentPromise) => previousPromise.then(() => currentPromise()), Promise.resolve()); + + return Promise.all([ + cfVersion, + updatePromise, ]); }; From e4529053f8096a7be9d02189cd98bf7118f2aa4b Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Tue, 23 Mar 2021 15:45:01 -0700 Subject: [PATCH 3/4] Use execSync instead of array-reduced promises --- .github/actions/bumpVersion/bumpVersion.js | 27 ++++++++++------------ .github/libs/nativeVersionUpdater.js | 24 ++++++++----------- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/.github/actions/bumpVersion/bumpVersion.js b/.github/actions/bumpVersion/bumpVersion.js index b5bd7b1a7aaa..aa697eeef915 100644 --- a/.github/actions/bumpVersion/bumpVersion.js +++ b/.github/actions/bumpVersion/bumpVersion.js @@ -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})); diff --git a/.github/libs/nativeVersionUpdater.js b/.github/libs/nativeVersionUpdater.js index b9b1ecb15193..d6d6865478d6 100644 --- a/.github/libs/nativeVersionUpdater.js +++ b/.github/libs/nativeVersionUpdater.js @@ -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'); @@ -74,24 +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 - const updatePromise = [ - 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}`), - ] - .reduce((previousPromise, currentPromise) => previousPromise.then(() => currentPromise()), Promise.resolve()); + // 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 Promise.all([ - cfVersion, - updatePromise, - ]); + // Return the cfVersion so we can set the NEW_IOS_VERSION in ios.yml + return cfVersion; }; From cc1d3801acec6084e39f7e9ace35c952ec5b9f45 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Tue, 23 Mar 2021 15:46:01 -0700 Subject: [PATCH 4/4] Rebuild GH actions --- .github/actions/bumpVersion/index.js | 53 ++++++++++++---------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/.github/actions/bumpVersion/index.js b/.github/actions/bumpVersion/index.js index a12af4713a20..760a935d1c34 100644 --- a/.github/actions/bumpVersion/index.js +++ b/.github/actions/bumpVersion/index.js @@ -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})); @@ -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); @@ -180,26 +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 - const updatePromise = [ - 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}`), - ] - .reduce((previousPromise, currentPromise) => previousPromise.then(() => currentPromise()), Promise.resolve()); - - return Promise.all([ - cfVersion, - updatePromise, - ]); + // 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; };