dhcgn / gh-update

Update you app with a github release

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Report Card

gh-update

gh-update is a Go package that provides functionality to update a Go application from a GitHub release.

Installation

To install gh-update, run the following command:

go get github.com/dhcgn/gh-update

Usage

GetLatestVersion

The GetLatestVersion function retrieves the latest release from a GitHub repository. It takes the following parameters:

  • name (string): The name of the GitHub repository, e.g. "dhcgn/gh-update".
  • version (string): The current version of the application.
  • assetfilter (string): A regex to filter the assets of the release, e.g. "^myapp-.*windows.*zip$".

The function returns a LatestRelease struct, which contains the name of the asset and the URL to download the asset.

SelfUpdateAndRestart

The SelfUpdateAndRestart function updates the current executable with the latest release from GitHub and restarts the application. It takes the following parameters:

  • latest (LatestRelease): The result of GetLatestVersion.
  • runningexepath (string): The path to the currently running executable.

SelfUpdateWithLatestAndRestart

The SelfUpdateWithLatestAndRestart function updates the current executable with the latest release from GitHub and restarts the application. It takes the following parameters:

  • name (string): The name of the GitHub repository, e.g. "dhcgn/gh-update".
  • version (string): The current version of the application.
  • assetfilter (string): A regex to filter the assets of the release, e.g. "^myapp-.*windows.*zip$".
  • runningexepath (string): The path to the currently running executable.

License

This project is licensed under the MIT License.

About

Update you app with a github release


Languages

Language:Go 98.1%Language:PowerShell 1.9%