Skip to content
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

Improve auto updater #869

Merged
merged 25 commits into from Nov 12, 2018
Merged

Improve auto updater #869

merged 25 commits into from Nov 12, 2018

Conversation

adlk
Copy link
Contributor

@adlk adlk commented Sep 20, 2018

This PR replaces the built in electron auto updater withelectron-updater. One of the major benefits is added support for windows updates (nsis) and works perfectly in sync with the electron-builder binaries.

We also don't longer need to maintain a custom API to manage releases. Releases are now handled directly via Github releases that are automatically created whenever a new tag is pushed.

How to do dev/ux-testing

  1. Make sure your package.json has a version lower than 1.2.0
  2. In project root, create the file dev-app-update.yml with the following content:
    # dev-app-update.yml
    owner: adlk
    repo: simplenote-test
    provider: github
  3. Run make start – assuming you have already built the web app once. Otherwise, run make dev
  4. Watch the console output of the main process to see something like.
    Checking for update
    Found version 1.2.0 (url: Simplenote-macOS-1.2.0.zip, Simplenote-macOS-1.2.0.dmg)
    Downloading update from Simplenote-macOS-1.2.0.zip, Simplenote-macOS-1.2.0.dmg

Please keep in mind that you can't actually update the app as you are running a local and unsigned binary of electron. So in any case, you'll most likely get an error when closing the update dialog. Even though we are in dev mode, all status events will be triggered.

How to do "production" testing

  1. Grab a built binary for Mac or Windows from CircleCI > Workflows > Automattic > simplenote-electron > test/auto-updater (latest build) > artifacts (job) > artifacts
  2. Install the app to e.g. /Applications
  3. Launch the app and wait for the auto updater to prompt
  4. Update and check that you are on Simplenote 1.2.0 (via menu: Simplenote > About Simplenote)

More infos about electron-updater can be found here.

@roundhill
Copy link
Contributor

roundhill commented Sep 24, 2018

Everything seemed to work OK for me until I tried the production testing. The app never updated on macOS. I got the prompt but the update didn't appear to install.

@adlk How can I get access to an AppVeyor build to test on Windows?

const { dialog } = require('electron');
const { autoUpdater } = require('electron-updater');
const sanitizeHtml = require('sanitize-html');
const TurndownService = require('turndown');
Copy link
Member

Choose a reason for hiding this comment

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

I wondered if we could do the HTML to MD conversion with showdown (the MD converter we're already using), but it looks like the feature hasn't shipped yet 🤷‍♀️ We'll replace it when it's released.

@mirka
Copy link
Member

mirka commented Sep 25, 2018

Are these the correct artifacts for Windows?
https://ci.appveyor.com/project/adlk/simplenote-electron/build/1.0.147/artifacts

Production tests:

  • Mac... Works as long as the app is in the Applications folder. However, there is quite a long period of no feedback during the download, which will worry the user. We should probably get in an enhancement PR with the download-progress (example) before we release this feature.
  • Linux (Ubuntu Bionic)... I could not get it to trigger an update dialog.
  • Windows (10)... Apps installed with both the .exe and .appx from the artifacts above did not trigger an update dialog. But more importantly, the app launches to a white screen of death 😱 Can you reproduce? Btw when building from source on Windows, npm run buildnpx electron . works, but both npm start and npm run dev results in a white screen.

@roundhill
Copy link
Contributor

  • Works as long as the app is in the Applications folder.

Ah this must have been my issue, I had it in a subfolder in Applications because I already had the native macOS app there.

@adlk
Copy link
Contributor Author

adlk commented Sep 26, 2018

@mirka @roundhill thanks for your review. I'll check your issues to figure out what's going on.

In the meantime, here are a few answers:

Are these the correct artifacts for Windows?
https://ci.appveyor.com/project/adlk/simplenote-electron/build/1.0.147/artifacts

yep, that's the one.

Windows (10)... Apps installed with both the .exe and .appx from the artifacts above did not trigger an update dialog.

The updater now prompts as expected, for whatever reasons, the windows config + artifacts were missing on the test repo.
Ad appx: the updater is disabled as the Windows Store has its own update mechanism.

...there is quite a long period of no feedback during the download, which will worry the user.

👍 In general, I'm a big fan of giving the user more feedback of what's happening – even if it's just a simple spinner. IMO, Github for Desktop does a great job (even though they just inform the user about the update once it's already downloaded)

Linux (Ubuntu Bionic)... I could not get it to trigger an update dialog.

🤦‍♂️ This is actually a stupid thinking error I've made. As the electron-updater checks Github for new releases. Everything that is using the manual updater (linux) is still accessing the old API.

@adlk adlk mentioned this pull request Sep 26, 2018
@adlk
Copy link
Contributor Author

adlk commented Sep 26, 2018

The white screen of death is fixed in #885

@adlk
Copy link
Contributor Author

adlk commented Oct 8, 2018

@mirka @roundhill I've now added support for the manual updater and did a refactor of the updater code base as this will be used for wp-desktop as well.

Together with Lena, we've decided to move away from parsing the changelog and showing it in the popup. Instead, we'll show a button to open the changelog.

screen shot 2018-09-28 at 14 50 12

@mirka mirka added this to the 1.2.1 milestone Oct 10, 2018
@mirka
Copy link
Member

mirka commented Oct 15, 2018

Thank you @adlk !

Production build tests

Updated artifacts for testing

https://circleci.com/gh/Automattic/simplenote-electron/703#artifacts/containers/0
https://ci.appveyor.com/project/Automattic/simplenote-electron/builds/19476778/artifacts

  • Works on Mac

  • Works on Windows, however there seems to be an escaping issue with the Update & Restart button label:
    screen shot 2018-10-13 at 8 55 17

  • Still could not get it to trigger on Ubuntu... Can you reproduce?

@mirka
Copy link
Member

mirka commented Oct 19, 2018

@adlk I was able to confirm it working on Ubuntu! Thanks.

@adlk
Copy link
Contributor Author

adlk commented Oct 30, 2018

@mirka the & issue on Windows is fixed. We now just need to wait for #971 to be resolved to get this landed 🎉

@mirka mirka mentioned this pull request Nov 1, 2018
1 task
desktop/config-updater.json Outdated Show resolved Hide resolved
@adlk adlk force-pushed the chore/improve-auto-updater branch from c38298b to b6affad Compare November 8, 2018 15:04
@adlk adlk merged commit c9b8d4a into master Nov 12, 2018
@adlk adlk deleted the chore/improve-auto-updater branch November 12, 2018 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants