It is currently April 16th, 2024, 6:38 am

Creating an update checker using GitHub

Tips and Tricks from the Rainmeter Community
User avatar
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA

Creating an update checker using GitHub

Post by raiguard »


NOTE: This is NOT a tutorial on how to use GitHub with Rainmeter. I am working on a tutorial on how to set up multiple repositories in the skins folder at once, but for now you'll have to figure it out by Googling it. Once you know how to use Git and GitHub, we can get started.

For this tutorial, I will walk through the code for a simple update checking sample skin, which you can download in the attachments section. Download and install the skin so you can follow along in the code.

First and foremost, this skin uses a GitHub repository to check a version number contained within a file in that repository. I'm not going to go over anything about using GitHub, but I will say this: You must have a file in the repo which contains only the version number of the latest released version of your skin. Once you do that, you're ready to implement the update checker!

The update checker consists of two main variables: 'version' and 'githubCurrentReleaseVerFilePath'. 'version' is simply the current version of your skin pack, and you will need to update the variable every time you release a new skin pack version. 'githubCurrentReleaseVerFilePath' is where you put the URL leading to the file discussed earlier. For example, in my illustro Gadgets skin pack the URL is "". Once you get this set up, the update checker will do its work when the skin is refreshed.

How to implement with your own skins
The update checker uses various measures to break down a version number you provide, break down the version number provided via GitHub, and perform a subtraction between the two to determine whether your version is more recent or older. If the numbers subtract to a positive value, you have an old version. If they subtract to 0, you're up to date. And if they subtract to a negative number, you are using an unreleased version.

The code below does this:

Code: Select all


RegExp="(?siU)<td id="LC1" class="blob-code blob-code-inner js-file-line">(.*)</td>.*"
FinishAction=[!EnableMeasure MeasureVersionCheck]



Formula=[MeasureCurrentReleaseVerAbsolute] - [MeasureVersionAbsolute]
IfAboveAction=[!SetOption UpdateCheckerString MeterStyle "StyleText | StyleUpdateCheckerYes"][!Redraw]
IfEqualAction=[!SetOption UpdateCheckerString MeterStyle "StyleText | StyleUpdateCheckerNo"][!Redraw]
IfBelowAction=[!SetOption UpdateCheckerString MeterStyle "StyleText | StyleUpdateCheckerDev"][!Redraw]
There are a few styles you need to have as well:

Code: Select all

Text="Update: Connecting to GitHub..."

Text="Update: v[MeasureCurrentReleaseVer] is available!"

Text="Update: Up to date"

Text="Update: Using dev version"
These styles are manipulated with the [MeasureVersionCheck] measure and change what the update checker's text is displaying. Keep in mind that you will need to rename 'UpdateCheckerString' to the name of the meter you use to display the update checker for this to work.

That's the most simple explanation I could come up with. If anybody has any questions, please feel free to leave a comment! I'll rewrite/restructure this tutorial if any new issues or questions crop up.
You do not have the required permissions to view the files attached to this post.
”We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.” - jsmorley, 2017