- Electron Projects
- Denys Vuika
- 313字
- 2021-06-24 12:14:40
Testing automatic updates
Testing the whole auto-update process takes a few steps since you need to install one version of the app, publish a new one, and then see what happens. Let's see those steps in practice:
- Go to the release page and download the installer package. For macOS, this is going to be in .dmg format:

- Install the app and run it to ensure it works as expected. Close the application for now; we are going to return to it shortly.
- Update the package.json file and set the version attribute to 1.1.0. Alternatively, you can run the following command to update the file:
npm version minor
- The output should be as follows:
v1.1.0
- Run the publish command once again to create a new release draft:
GH_TOKEN=<YOUR-TOKEN> npm run publish:github
- Now, you should have two releases on GitHub, including a new draft for version 1.1.0:

- Perform the same steps you performed earlier and publish the new release. Then, run the application you downloaded and installed earlier.
- In a few seconds, after startup, the automatic updater will raise a system notification, saying that a new version of the application has been downloaded and ready to install:

- Quit the application and run it once again. At this point, you should be using the latest version, that is, 1.1.0 (at the time of writing).
- You can use the standard Electron framework out of the box to check that your application version is the latest one:

- Note the vision value; it is now 1.1.0:

Well done and congratulations on setting up publishing and automatic updates for your application!
As an exercise, try to configure building and publishing for other platforms. Be sure to test the installation and upgrade process with Windows or Ubuntu Linux if you have real or virtual machines nearby.
In the next section, we are going to provide a proper title for our application.
推薦閱讀
- Rake Task Management Essentials
- Mastering Concurrency in Go
- Learning C++ Functional Programming
- Python Deep Learning
- Koa開發:入門、進階與實戰
- 深度學習:算法入門與Keras編程實踐
- C語言程序設計教程
- 單片機C語言程序設計實訓100例
- Multithreading in C# 5.0 Cookbook
- 基于SpringBoot實現:Java分布式中間件開發入門與實戰
- C編程技巧:117個問題解決方案示例
- MySQL數據庫應用實戰教程(慕課版)
- Spring Data JPA從入門到精通
- Python編程快速上手2
- Python Linux系統管理與自動化運維