-
Notifications
You must be signed in to change notification settings - Fork 74
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
feat: update macOS asset matching #169
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Adam Setch <[email protected]>
Signed-off-by: Adam Setch <[email protected]>
Signed-off-by: Adam Setch <[email protected]>
Signed-off-by: Adam Setch <[email protected]>
Signed-off-by: Adam Setch <[email protected]>
Signed-off-by: Adam Setch <[email protected]>
Signed-off-by: Adam Setch <[email protected]>
Some before and after examples
|
src/updates.js
Outdated
@@ -210,6 +224,7 @@ class Updates { | |||
for (const release of releases) { | |||
if ( | |||
!semver.valid(release.tag_name) || | |||
semver.lt(release.tag_name, version) || |
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.
This change in behavior seems unrelated? Can you explain this change and why it's needed in this PR
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.
Thanks for the review @MarshallOfSound - apologies for not calling out this change.
This change was important to ensure that assets from previous releases weren't being matched.
For example, without this change http://localhost:62178/gitify-app/gitify/darwin-x64/5.14.0
and http://localhost:62178/gitify-app/gitify/darwin-arm64/5.14.0
were both finding the "latest" assets from a really old release https://github.com/gitify-app/gitify/releases/tag/v4.2.1 (the last time we published non-universal artifacts).
This then causes the following empty response and inaccurate log message
update.electronjs.org/src/updates.js
Lines 110 to 113 in 3638132
} else if (semver.lte(latest.version, version)) { | |
log.debug({ account, repository, platform, version }, "up to date"); | |
noContent(res); | |
} else { |
Adding in the above check ensures that only newer versions are considered eligible for the latest
assets object
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.
This isn't an issue with your other changes in this PR right, i.e. you don't need this now that you've added universal
fallback?
The regex changes seem safe at a glance, but changing this lte
from it's original defense location would require more thinking. If you remove this lt
change reviewing this PR will be much easier and will be more likely it lands.
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.
Actually, this change is required as part of this PR for it to work.
Without it, latest
is not null, therefore it never falls back to checking if the universal release is newer.
eg:
latest === {name: "v4.2.1", ...}
latestUniversal === {name: "v5.15.0", ...}
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.
This logic can either be where I've placed it, or in the universal release block (ie: semver.gt(universal.version, latest.version)...
I went with the former since that is where the other asset tags are skipped over (prerelease, draft, invalid semver)
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.
Hm, can we modify the fallback logic from: "get x64/arm64, if not exists get universal" or just consider unviersal
builds arm64/x64
builds by default if no arm64/x64 specific build is present. i.e. it's a fallback within get asset, rather than a separate call?
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.
i.e. in here
update.electronjs.org/src/updates.js
Line 175 in 3638132
return latest && latest[platform]; |
Just do effective if (!latest[platform] && platform === A_DARWIN_PLATFORM && latest[universal]) return latest[universal]
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.
Removed the lt
check and changes where the latestUniversal replacement occurs
Signed-off-by: Adam Setch <[email protected]>
Signed-off-by: Adam Setch <[email protected]>
Signed-off-by: Adam Setch <[email protected]>
|
||
if ( | ||
latestUniversal && | ||
semver.gt(latestUniversal.version, latest.version) |
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.
@MarshallOfSound - moved the semver check here to be part of the universal replacement logic
Signed-off-by: Adam Setch <[email protected]>
Signed-off-by: Adam Setch <[email protected]>
Now with added unit tests for the new universal logic |
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.
Great addition, wasn't aware this wasn't supported yet! We're standing on the shoulders of giants!!
@MarshallOfSound - any further feedback you have re: this enhancement proposal? Really looking forward to my two user groups getting back on the auto-upgrade pathway |
Signed-off-by: Adam Setch <[email protected]>
…com/setchy/update.electronjs.org into fix/electron-builder-default-naming
Signed-off-by: Adam Setch <[email protected]>
Signed-off-by: Adam Setch <[email protected]>
@MarshallOfSound @erickzhao @dsanders11 - any additional feedback you may offer? If not, could we look to have this enhancement released 🙏 |
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.
Overall this LGTM.
I see that this does disallow the edge case where the file ZIP is just called mac.zip
but the regex for win32 still seems to accept something like win32.zip
.
Maybe a good follow-up PR to this would be to add the leading -
to the Windows regex patterns as well to get parity between platforms.
@erickzhao - thanks for the review 🙏 I can certainly raise a separate PR for the windows regex. For this PR, what are the next steps to have this change merged and released? |
I was going to ask other maintainers if they had feedback but otherwise I don't think there's anything to do on your end! |
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.
Reviewed the code and it looks reasonable - changes asked for in the PR discussions also seem to be addressed
Resolves #168, #140, #166, #113
Updates the macOS (darwin) asset matching logic to
.zip
(eg: blockmap assets)