How do I set the program to automatically check for updates from a Github repository? (C++)

Viewed 50

I'm fairly new to this so I need help with something.

I've figured out how to use an elevated command prompt to install both Chocolatey and git, and then use git to clone a repository from github. However, I'm having trouble understanding how to implement this process automatically into a C++ executable, or if this process is even the desired method of automatic updates.

If anyone has a better solution that doesn't involve Chocolatey or github in order to make my executable automatically update, I'm all ears.

1 Answers

I assume you have a base machine where you are going to run this.

The best way to do it would be with a bash script under crontab.

You set your crontab say every day at 6am by adding something like this

30 6 * * * /home/fred/bin/recompile.sh

Inside recompile.sh you set up code to refresh your repository and recompile

#!/usr/bin/bash
VERSION=1.0.1
cd /home/fred/git/myrepo
git pull
rm -rf build && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/fred/install/$VERSION ..
cmake --build . --target install

That would be the minimum to recompile your build

Related