https://github.com/dhcgn/gh-update
Update you app with a github release
https://github.com/dhcgn/gh-update
Last synced: 3 months ago
JSON representation
Update you app with a github release
- Host: GitHub
- URL: https://github.com/dhcgn/gh-update
- Owner: dhcgn
- Created: 2022-11-08T17:24:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-22T21:31:20.000Z (over 1 year ago)
- Last Synced: 2025-01-23T13:08:21.119Z (5 months ago)
- Language: Go
- Size: 33.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://goreportcard.com/report/github.com/dhcgn/gh-update)
# gh-updategh-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:
```bash
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](LICENSE).