-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[No QA] Ensure bundle version strings are compatible before auto-merging CP PR #6199
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5fe290e
add function for checking bundleVersion strings
Jag96 40b9bac
move to separate workflow
Jag96 ccb26fb
update cherry-pick workflow to include check
Jag96 ca6f36f
rebuild actions
Jag96 f7e47d2
make PR if bundle versions don't match
Jag96 61f747f
update hash to fix verify workflow
Jag96 719f54d
fix indent
Jag96 38f55cd
update ref back to main
Jag96 2b4063f
add fallback
Jag96 e9b0c92
update actions
Jag96 ed931d5
add logging for easier debugging
Jag96 1557ae8
update actions
Jag96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
16 changes: 16 additions & 0 deletions
16
.github/actions/checkBundleVersionStringMatch/checkBundleVersionStringMatch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) { | ||
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); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:App/.github/libs/nativeVersionUpdater.js
Line 79 in fa2e8a9
That means in terms of your example from the PR body:
1-1-1-0
this would be1
and then on the next line we add another zero to the version:App/.github/libs/nativeVersionUpdater.js
Line 80 in fa2e8a9
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:1.1.1
and1.1.1.0
1.1.1
and1.1.0.0
Thank you for explanation of this.
There was a problem hiding this comment.
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 is1.1.1-0
and the shortBundleVersion is1.1.1
, then they would match. Let me know if that makes sense!There was a problem hiding this comment.
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!