Skip to content

Compare GitHub versions and download latest release assets.

License

Notifications You must be signed in to change notification settings

sweallar/GitHub.ReleaseDownloader

 
 

Repository files navigation


GitHubReleaseDownloader
GitHub Release Downloader

Compare GitHub versions and download latest release assets.

Background

Small .NET framework library to compare versions and download the latest GitHub release.

Key Features

  • Check if current version is most recent using SemVer.
  • Download latest release artifacts from GitHub releases.
  • Include / exclude pre-releases.

How To Use

// 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();

Considerations

  • 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.

How To Contribute

Feel free to open an issue or submit a PR.

About

Compare GitHub versions and download latest release assets.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%