Skip to content

Commit

Permalink
build actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tgolen committed May 8, 2023
1 parent b4477ee commit 63bc287
Show file tree
Hide file tree
Showing 17 changed files with 2,000 additions and 2,133 deletions.
289 changes: 139 additions & 150 deletions .github/actions/javascript/authorChecklist/index.js

Large diffs are not rendered by default.

295 changes: 144 additions & 151 deletions .github/actions/javascript/awaitStagingDeploys/index.js

Large diffs are not rendered by default.

18 changes: 7 additions & 11 deletions .github/actions/javascript/bumpVersion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ function updateNativeVersions(version) {

let semanticVersionLevel = core.getInput('SEMVER_LEVEL', {require: true});
if (!semanticVersionLevel || !_.contains(versionUpdater.SEMANTIC_VERSION_LEVELS, semanticVersionLevel)) {
console.log(
`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`,
`Defaulting to: ${versionUpdater.SEMANTIC_VERSION_LEVELS.BUILD}`,
);
console.log(`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`, `Defaulting to: ${versionUpdater.SEMANTIC_VERSION_LEVELS.BUILD}`);
semanticVersionLevel = versionUpdater.SEMANTIC_VERSION_LEVELS.BUILD;
}

Expand Down Expand Up @@ -94,9 +91,7 @@ const getPatchVersion = __nccwpck_require__(866);
const getBuildVersion = __nccwpck_require__(14);

// Filepath constants
const BUILD_GRADLE_PATH = process.env.NODE_ENV === 'test'
? path.resolve(__dirname, '../../android/app/build.gradle')
: './android/app/build.gradle';
const BUILD_GRADLE_PATH = process.env.NODE_ENV === 'test' ? path.resolve(__dirname, '../../android/app/build.gradle') : './android/app/build.gradle';
const PLIST_PATH = './ios/NewExpensify/Info.plist';
const PLIST_PATH_TEST = './ios/NewExpensifyTests/Info.plist';

Expand Down Expand Up @@ -146,12 +141,13 @@ exports.generateAndroidVersionCode = function generateAndroidVersionCode(npmVers
*/
exports.updateAndroidVersion = function updateAndroidVersion(versionName, versionCode) {
console.log('Updating android:', `versionName: ${versionName}`, `versionCode: ${versionCode}`);
return fs.readFile(BUILD_GRADLE_PATH, {encoding: 'utf8'})
return fs
.readFile(BUILD_GRADLE_PATH, {encoding: 'utf8'})
.then((content) => {
let updatedContent = content.toString().replace(/versionName "([0-9.-]*)"/, `versionName "${versionName}"`);
return updatedContent = updatedContent.replace(/versionCode ([0-9]*)/, `versionCode ${versionCode}`);
return (updatedContent = updatedContent.replace(/versionCode ([0-9]*)/, `versionCode ${versionCode}`));
})
.then(updatedContent => fs.writeFile(BUILD_GRADLE_PATH, updatedContent, {encoding: 'utf8'}));
.then((updatedContent) => fs.writeFile(BUILD_GRADLE_PATH, updatedContent, {encoding: 'utf8'}));
};

/**
Expand Down Expand Up @@ -200,7 +196,7 @@ const MAX_INCREMENTS = 99;
*/
const getVersionNumberFromString = (versionString) => {
const [version, build] = versionString.split('-');
const [major, minor, patch] = _.map(version.split('.'), n => Number(n));
const [major, minor, patch] = _.map(version.split('.'), (n) => Number(n));

return [major, minor, patch, Number.isInteger(Number(build)) ? Number(build) : 0];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ const getPatchVersion = __nccwpck_require__(866);
const getBuildVersion = __nccwpck_require__(14);

// Filepath constants
const BUILD_GRADLE_PATH = process.env.NODE_ENV === 'test'
? path.resolve(__dirname, '../../android/app/build.gradle')
: './android/app/build.gradle';
const BUILD_GRADLE_PATH = process.env.NODE_ENV === 'test' ? path.resolve(__dirname, '../../android/app/build.gradle') : './android/app/build.gradle';
const PLIST_PATH = './ios/NewExpensify/Info.plist';
const PLIST_PATH_TEST = './ios/NewExpensifyTests/Info.plist';

Expand Down Expand Up @@ -97,12 +95,13 @@ exports.generateAndroidVersionCode = function generateAndroidVersionCode(npmVers
*/
exports.updateAndroidVersion = function updateAndroidVersion(versionName, versionCode) {
console.log('Updating android:', `versionName: ${versionName}`, `versionCode: ${versionCode}`);
return fs.readFile(BUILD_GRADLE_PATH, {encoding: 'utf8'})
return fs
.readFile(BUILD_GRADLE_PATH, {encoding: 'utf8'})
.then((content) => {
let updatedContent = content.toString().replace(/versionName "([0-9.-]*)"/, `versionName "${versionName}"`);
return updatedContent = updatedContent.replace(/versionCode ([0-9]*)/, `versionCode ${versionCode}`);
return (updatedContent = updatedContent.replace(/versionCode ([0-9]*)/, `versionCode ${versionCode}`));
})
.then(updatedContent => fs.writeFile(BUILD_GRADLE_PATH, updatedContent, {encoding: 'utf8'}));
.then((updatedContent) => fs.writeFile(BUILD_GRADLE_PATH, updatedContent, {encoding: 'utf8'}));
};

/**
Expand Down
Loading

0 comments on commit 63bc287

Please sign in to comment.