| Crates.io | release-hub |
| lib.rs | release-hub |
| version | 0.2.0 |
| created_at | 2025-11-13 02:26:45.452376+00 |
| updated_at | 2025-11-13 06:33:56.469572+00 |
| description | A simple updater for Rust GUI applications |
| homepage | |
| repository | https://github.com/tangxiangong/release-hub |
| max_upload_size | |
| id | 1930314 |
| size | 124,223 |
This crate helps your application check for the latest GitHub Releases and download/install the proper artifact for the current platform. It focuses on a minimal API surface, safe defaults, and a predictable end-user experience on macOS and Windows.
octocrabsemver.app.zip and swaps the app bundle atomically).exe/.msi installer, launches with elevation when needed)Linux is currently not supported for install flow. The crate compiles on Linux for development, but installation logic is provided only for macOS and Windows.
Add to your Cargo.toml:
[dependencies]
release-hub = "*"
Basic usage:
use release_hub::{UpdaterBuilder};
use semver::Version;
#[tokio::main]
async fn main() -> release_hub::Result<()> {
let updater = UpdaterBuilder::new(
"MyApp", // Application name (for temp files / logs)
"0.1.0", // Current version
"owner", // GitHub owner
"repo", // GitHub repo
)
.build()?;
// Option A: one-shot convenience
let updated = updater.update(|chunk| {
// chunk = size of bytes received in this tick
let _ = chunk;
}).await?;
if updated {
// Relaunch when appropriate for your app lifecycle
// updater.relaunch()?;
}
Ok(())
}
Manual flow:
let updater = /* build as above */;
if let Some(ready) = updater.check().await? {
let bytes = ready.download(|_| {}).await?;
ready.install(bytes)?;
// ready.relaunch()?; // Optional: relaunch the updated app
}
Example:
use http::header::{AUTHORIZATION, HeaderValue};
use url::Url;
let updater = UpdaterBuilder::new("MyApp", "0.1.0", "owner", "repo")
.header(AUTHORIZATION, HeaderValue::from_static("token OAUTH_OR_PAT"))?
.proxy(Url::parse("http://proxy.local:8080").unwrap())
.timeout(std::time::Duration::from_secs(60))
.build()?;
.app.zip, replaces the .app atomically, elevating when necessaryShellExecuteW and runas verb for elevationQ: Where should I call relaunch()?
A: Only after your UI and background tasks are safely shut down. On Windows, the installer typically handles termination. On macOS, you control when to reopen the app.
Q: How are assets matched?
A: Filenames are inspected for OS and arch markers, and known extensions are matched: .app.zip, .dmg, .exe, .msi.
Copyright (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
Adapt for universal Rust crate
Remove Tauri-specific runtime integration
Use octocrab library for GitHub API interaction
Detailed Info: For complete attribution information, please refer to the NOTICE file
Licensed under either of:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.