Skip to content

Commit

Permalink
build actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jag96 committed Dec 7, 2021
1 parent 25a7f3d commit d88a86d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ console.log(`Bundle Version: ${bundleVersion}`);
console.log(`Short Bundle Version: ${shortBundleVersion}`);

const hasValue = shortBundleVersion && bundleVersion;
if (!hasValue || (shortBundleVersion !== (bundleVersion.split('-') || [''])[0])) {
if (!hasValue) {
console.log('Failed to get Bundle Versions from plist');
core.setOutput('BUNDLE_VERSIONS_MATCH', false);
} else if (shortBundleVersion !== (bundleVersion.split('-') || [''])[0]) {
console.log('Bundle Versions do not match');
core.setOutput('BUNDLE_VERSIONS_MATCH', false);
} else {
Expand Down
11 changes: 8 additions & 3 deletions .github/actions/checkBundleVersionStringMatch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ const core = __nccwpck_require__(186);
const {execSync} = __nccwpck_require__(129);
const {PLIST_PATH} = __nccwpck_require__(322);

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) {
console.log('Failed to get Bundle Versions from plist');
core.setOutput('BUNDLE_VERSIONS_MATCH', false);
} else if (shortBundleVersion !== (bundleVersion.split('-') || [''])[0]) {
console.log('Bundle Versions do not match');
core.setOutput('BUNDLE_VERSIONS_MATCH', false);
} else {
Expand Down

0 comments on commit d88a86d

Please sign in to comment.