Skip to content
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
8 changes: 8 additions & 0 deletions .github/actions/checkBundleVersionStringMatch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: 'Check if Bundle Versions Match'
description: "Check if the CFBundleVersion string is compatible with the CFBundleShortVersionString"
outputs:
BUNDLE_VERSIONS_MATCH:
description: Whether or not the bundle versions match
runs:
using: 'node12'
main: './index.js'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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}`);

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: This comment is more for me to learn. I see in nativeVersionUpdater.js that the shortBundleVersion is obtained as following:

const shortVersion = version.split('-')[0];

That means in terms of your example from the PR body: 1-1-1-0 this would be 1 and then on the next line we add another zero to the version:

const cfVersion = version.includes('-') ? version.replace('-', '.') : `${version}.0`;

What I do not understand is taking the first - [0] element of the split would not check for the case you have described in the PR body:

  • Compatible bundle version strings: 1.1.1 and 1.1.1.0
  • Incompatible bundle version strings: 1.1.1 and 1.1.0.0

Thank you for explanation of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, no worries! So in this case we're grabbing the version number from the info.plist, which has the versions formatted as x.x.x-x. So if the bundleVersion is 1.1.1-0 and the shortBundleVersion is 1.1.1, then they would match. Let me know if that makes sense!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahaa! That makes a lot of sense, did not catch that, thank you!

console.log('Bundle Versions do not match');
core.setOutput('BUNDLE_VERSIONS_MATCH', false);
} else {
console.log('Bundle Versions match');
core.setOutput('BUNDLE_VERSIONS_MATCH', true);
}
Loading