Updater integration with GitHub - Beginners Oriented How-To

Discover(request) our samples to help you get started with your project.
Post Reply
Catalin
Posts: 2959
Joined: Wed Jun 13, 2018 7:49 am

Updater integration with GitHub - Beginners Oriented How-To

Post by Catalin » Thu Jun 25, 2020 3:00 pm

Hello guys,

As you may already know, recently, due to a high number of requests, we have added a new feature in Advanced Installer - the integration of our "Updater" feature with GitHub.

For more information about this, please have a look on our "How to integrate the Updater with GitHub?" article.

Normally, this feature is intended to target people that are already familiar with GitHub - as it was requested mostly by people already using GitHub on a daily basis and releasing their products with it - and its' REST API.

However, there might be some other users who are just getting started with this and might need help in achieving the integration of our "Updater" feature with GitHub, therefore I have decided to create this How-To.

First thing that needs to be noted here is the fact that this feature does not work exactly the same as our usual "Updater" feature.

If you need more information about our "usual" Updater feature, please have a look on our "Using the Updater" article.

Now that we have that the two methods are quite different, let's talk a bit about the second method and how that differs from the first one.

First of all, in order to integrate the "Updater" with GitHub, all you need to do is:
  • go to "Updater" page
  • under "Updater" section, select the "Check for updates using Advanced Updater" option
  • select the "GitHub integration" option
  • in the "Updates Configuration file URL" field, we will need to input the URL to the "configuration file"
The confusion regarding this feature is mostly created at the last point (the "Updates Configuration file URL" field). To avoid such confusion, please allow me to explain how this works.

Earlier, I have mentioned that this method makes use of the "GitHub API".

All access to the above mentioned API is done over HTTPS, and accessed from https://api.github.com.

All data is sent and received as JSON.

The above information is really important. Basically, every HTTPS request that is done to the API will return a response in a form of a JSON file.

This response is then interpreted by our "Updater" tool (we will talk about how our Updater tool interprets the JSON file a little bit later).

To be more specific here, our Updater tool makes use of the GitHub Release API. For more information about this, please have a look over the "Releases" section of the "GitHub REST API" article.

To better understand this, let's have a look over the following example.

Let's consider we have the following repositories:

Repositories.png
Repositories.png (54.49 KiB) Viewed 1344 times

Here, I have highlighted the "hello-world-updater" repository as that is the one we will use as an example.

This repository has only one release:

HelloWorldRelease.png
HelloWorldRelease.png (103.51 KiB) Viewed 1344 times

If we want to access the information about our release through the API, we can proceed as it follows:
  • open a new tab in your web browser and access the following link:

Code: Select all

https://api.github.com/repos/<username>/<repository_name>/releases
For instance, in our case, the link will look something as it follows:

Code: Select all

https://api.github.com/repos/catalinkmihai/hello-world-updater/releases
where:

<username> = catalinkmihai

<repository_name> = hello-world-updater

The above will generate a response that looks as it follows (I have used two screenshots here for a better clarity):

ReleasesJSONFirst.png
ReleasesJSONFirst.png (154.84 KiB) Viewed 1344 times
ReleasesJSONSecond.png
ReleasesJSONSecond.png (191.84 KiB) Viewed 1344 times

As you can see, this does not quite look like the configuration file generated by our "Updates Configuration File" project:

UpdatesConfigFIle.png
UpdatesConfigFIle.png (31.02 KiB) Viewed 1344 times

In order for the Updater tool to be able to interpret the fields returned by the request, we had to map them to the current fields used in the configuration file.

The mapping is explained in the "How to integrate the Updater with GitHub" article (which I have linked above).

In the article, we can see, for example, that the "tag_name" field (returned by the request) is mapped to "Version" field (generated by the "Updates Configuration File" project).

Taking in consideration the above explanation => that your release tag should contain a higher version than the already installed application, in order for the Updater tool to consider it a new version of your product.

Now that we have explained how this works and hopefully everything is more clear now, let's consider the following step-by-step which showcases a scenario that integrates the Updater tool with GitHub:
  • first of all, we will need to create a new repository
  • for this repository, we will need to create a new release
Here, please note, as I have previously explained, that the "Tag" should be of a higher version than the already installed setup. For instance, if we are going to install version 1.0.0 of our product, the "Tag" should have a higher value (e.g. v2.0).
  • now please open Advanced Installer and create a new project
  • go to "Updater" page and select the "Check for updates using Advanced Updater" option
  • select the "GitHub integration" option
in the "Updates Configuration File" field, please insert the following:
e.g.:

AIUpdaterGitHubIntegration.png
AIUpdaterGitHubIntegration.png (70.06 KiB) Viewed 1344 times
  • build the project
  • install the resulted package
  • now please go to "Product Details" page and increase the "Version" (e.g. 1.0.0 --> 2.0.0)
  • rebuild the project. When asked to generate a new ProductCode, please select "Generate New"
  • the generated package should now be added as an "Asset" to our earlier created "Release". To do so, select your Repository --> select your Release --> "Edit Release" --> add the earlier built package as an asset, e.g.:
Assets.png
Assets.png (64.63 KiB) Viewed 1344 times
Assets2.png
Assets2.png (122.76 KiB) Viewed 1344 times

After doing so, now please go to the installation folder of the first version and double click on the "updater.exe" tool. If everything was configured correctly, the Updater should detect the newer version and then download and install the package.

UpdatesFound.png
UpdatesFound.png (44.03 KiB) Viewed 1344 times

Hope this helps!


Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

t3knomanzer
Posts: 7
Joined: Wed Jun 17, 2020 7:18 pm

Re: Updater integration with GitHub - Beginners Oriented How-To

Post by t3knomanzer » Thu Jun 25, 2020 6:39 pm

Hi Catalin,

Thank you for taking the time to write this. Unfortunately it's still now working for me, I am now getting a different error.
error.JPG
error.JPG (13.44 KiB) Viewed 1320 times
* I have set the updates url to the correct link, verified it by navigating to it in a browser.
* I built the installer (0.1.5) and installed it on my computer.
* Created a tag in git and pushed it to the repo (v0.1.6)
* Created a release from it
* Increased the version number of my installer, generated a new key and built the installer
* Uploaded the installer to my release
* Ran the updater.exe locally

Here is the releases api url: https://api.github.com/repos/t3knomanze ... /releases

Code: Select all

[
  {
    "url": "https://api.github.com/repos/t3knomanzer/maxmix-software/releases/27927803",
    "assets_url": "https://api.github.com/repos/t3knomanzer/maxmix-software/releases/27927803/assets",
    "upload_url": "https://uploads.github.com/repos/t3knomanzer/maxmix-software/releases/27927803/assets{?name,label}",
    "html_url": "https://github.com/t3knomanzer/maxmix-software/releases/tag/v0.1.6",
    "id": 27927803,
    "node_id": "MDc6UmVsZWFzZTI3OTI3ODAz",
    "tag_name": "v0.1.6",
    "target_commitish": "master",
    "name": "My Release 0.1.6",
    "draft": false,
    "author": {
      "login": "t3knomanzer",
      "id": 2942293,
      "node_id": "MDQ6VXNlcjI5NDIyOTM=",
      "avatar_url": "https://avatars0.githubusercontent.com/u/2942293?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/t3knomanzer",
      "html_url": "https://github.com/t3knomanzer",
      "followers_url": "https://api.github.com/users/t3knomanzer/followers",
      "following_url": "https://api.github.com/users/t3knomanzer/following{/other_user}",
      "gists_url": "https://api.github.com/users/t3knomanzer/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/t3knomanzer/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/t3knomanzer/subscriptions",
      "organizations_url": "https://api.github.com/users/t3knomanzer/orgs",
      "repos_url": "https://api.github.com/users/t3knomanzer/repos",
      "events_url": "https://api.github.com/users/t3knomanzer/events{/privacy}",
      "received_events_url": "https://api.github.com/users/t3knomanzer/received_events",
      "type": "User",
      "site_admin": false
    },
    "prerelease": false,
    "created_at": "2020-06-24T03:28:28Z",
    "published_at": "2020-06-25T17:27:12Z",
    "assets": [
      {
        "url": "https://api.github.com/repos/t3knomanzer/maxmix-software/releases/assets/22080258",
        "id": 22080258,
        "node_id": "MDEyOlJlbGVhc2VBc3NldDIyMDgwMjU4",
        "name": "maxmix.exe",
        "label": null,
        "uploader": {
          "login": "t3knomanzer",
          "id": 2942293,
          "node_id": "MDQ6VXNlcjI5NDIyOTM=",
          "avatar_url": "https://avatars0.githubusercontent.com/u/2942293?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/t3knomanzer",
          "html_url": "https://github.com/t3knomanzer",
          "followers_url": "https://api.github.com/users/t3knomanzer/followers",
          "following_url": "https://api.github.com/users/t3knomanzer/following{/other_user}",
          "gists_url": "https://api.github.com/users/t3knomanzer/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/t3knomanzer/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/t3knomanzer/subscriptions",
          "organizations_url": "https://api.github.com/users/t3knomanzer/orgs",
          "repos_url": "https://api.github.com/users/t3knomanzer/repos",
          "events_url": "https://api.github.com/users/t3knomanzer/events{/privacy}",
          "received_events_url": "https://api.github.com/users/t3knomanzer/received_events",
          "type": "User",
          "site_admin": false
        },
        "content_type": "application/x-msdownload",
        "state": "uploaded",
        "size": 8652459,
        "download_count": 0,
        "created_at": "2020-06-25T17:27:32Z",
        "updated_at": "2020-06-25T17:29:13Z",
        "browser_download_url": "https://github.com/t3knomanzer/maxmix-software/releases/download/v0.1.6/maxmix.exe"
      }
    ],
    "tarball_url": "https://api.github.com/repos/t3knomanzer/maxmix-software/tarball/v0.1.6",
    "zipball_url": "https://api.github.com/repos/t3knomanzer/maxmix-software/zipball/v0.1.6",
    "body": "This is a test release"
  }
]
Here are my updater settings:
updater_settings.JPG
updater_settings.JPG (29.24 KiB) Viewed 1320 times
Here is the updater .ini for confirmation:

Code: Select all

[General]
AppDir=C:\Users\ruben\AppData\Roaming\Ruben Henares\Maxmix\
ApplicationName=Maxmix
CompanyName=Ruben Henares
ApplicationVersion=0.1.5
DefaultCommandLine=/checknow
CheckFrequency=2
DownloadsFolder=C:\ProgramData\Ruben Henares\Maxmix\Updates\
Flags=PerMachine|ShowConfigOptionsButton|GitHubUpdates
ID={EC96F2C7-249D-43AE-8D60-403C4FC66047}
URL=https://api.github.com/repos/t3knomanzer/maxmix-software/releases

t3knomanzer
Posts: 7
Joined: Wed Jun 17, 2020 7:18 pm

Re: Updater integration with GitHub - Beginners Oriented How-To

Post by t3knomanzer » Thu Jun 25, 2020 7:02 pm

I figured it out... the problem seems to be with .exe installers.
I uploaded a dummy .msi file and it seems to work fine with it. Is there any chance .exe installers will be supported?

Thanks.

Catalin
Posts: 2959
Joined: Wed Jun 13, 2018 7:49 am

Re: Updater integration with GitHub - Beginners Oriented How-To

Post by Catalin » Wed Jul 01, 2020 3:45 pm

Hello,

First of all, please accept my apologies for the delayed reply.
I figured it out... the problem seems to be with .exe installers.
This is quite strange, indeed.

As far as I know, this should be working with an EXE setup package as well, although I have to admit that I did not test this scenario with one.

I will start investigating this and I will let you know once I will reach a conclusion.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Catalin
Posts: 2959
Joined: Wed Jun 13, 2018 7:49 am

Re: Updater integration with GitHub - Beginners Oriented How-To

Post by Catalin » Tue Jul 07, 2020 9:17 am

Hello,

I have further tested this and everything worked as expected on my end.

I would say that there might be something blocking the Updater from accessing the .EXE file. Please make sure that you do not have an AntiVirus / Firewall rule that is blocking the download process of the .EXE file.

Could you please test this scenario on a clean machine (e.g. a Virtual Machine with a new image of Windows - without an AntiVirus) and let me know if you can still reproduce this?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Post Reply