Skip to content

Commit

Permalink
use grep/sed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jag96 committed Dec 7, 2021
1 parent bddd3c5 commit 25a7f3d
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ const core = require('@actions/core');
const {execSync} = require('child_process');
const {PLIST_PATH} = require('../../libs/nativeVersionUpdater');

const bundleVersion = execSync(`/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" ${PLIST_PATH}`);
const shortBundleVersion = execSync(`/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" ${PLIST_PATH}`);
const bundleVersion = execSync(`grep -A1 'CFBundleVersion' ${PLIST_PATH} | grep -v 'CFBundleVersion' | sed 's|[</string>,]||g')`).toString().trim();
const shortBundleVersion = execSync(`grep -A1 'CFBundleShortVersionString' ${PLIST_PATH} | grep -v 'CFBundleShortVersionString' | sed 's|[</string>,]||g')`).toString().trim();

console.log(`Bundle Version: ${bundleVersion}`);
console.log(`Short Bundle Version: ${shortBundleVersion}`);
if (shortBundleVersion !== (bundleVersion.split('-') || [''])[0]) {

const hasValue = shortBundleVersion && bundleVersion;
if (!hasValue || (shortBundleVersion !== (bundleVersion.split('-') || [''])[0])) {
console.log('Bundle Versions do not match');
core.setOutput('BUNDLE_VERSIONS_MATCH', false);
} else {
Expand Down

0 comments on commit 25a7f3d

Please sign in to comment.