Small .NET framework library to compare versions and download the latest GitHub release.
- Check if current version is most recent using SemVer.
- Download latest release artifacts from GitHub releases.
- Include / exclude pre-releases.
// create settings object
HttpClient httpClient = new HttpClient();
string author = "kalilistic";
string repo = "github.releasedownloader";
bool includePreRelease = true;
string downloadDirPath = "C:\assets";
IReleaseDownloaderSettings settings = new ReleaseDownloaderSettings(httpClient, author, repo, includePreRelease, downloadDirPath);
// create downloader
IReleaseDownloader downloader = new ReleaseDownloader(settings);
// check version
string currentVersion = "5.0.0";
bool isMostRecentVersion = downloader.IsLatestRelease(currentVersion);
// download latest github release
if (!isMostRecentVersion) {
downloader.DownloadLatestRelease();
}
// clean up
downloader.DeInit();
httpClient.Dispose();
- Versions must be SemVer-compliant or exception will be thrown.
- Will not compare and silently skip over GitHub releases that aren't Semver-compliant.
- GitHub API calls are made anonymously and subject to rate limits.
Feel free to open an issue or submit a PR.