Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip sha (sha1, sha256, sha512) checksum files #130

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

brianheineman
Copy link

Skip sha (sha1, sha256, sha512) checksum files when determining the release asset. Many projects (e.g. https://github.com/BurntSushi/ripgrep/releases, https://github.com/theseus-rs/rsql/releases, etc) include hash files with their releases, this change ignores the .sha* hash files when attempting to find the release archive.

@jaemk
Copy link
Owner

jaemk commented Jul 3, 2024

hey @brianheineman, thanks for adding this! Could you make this configurable? either adding a skip_extensions: Option<&[&str]> argument or ideally to maintain backwards compatibility adding a separate method asset_for_config(config: &AssetMatchConfig) that takes some new config struct with the options

@brianheineman
Copy link
Author

Hello @jaemk, I made changes that should be more flexible and backwards compatible by allowing a "match function" to be specified.

fn update() -> Result<(), Box<::std::error::Error>> {
    let status = self_update::backends::github::Update::configure()
        .repo_owner("jaemk")
        .repo_name("self_update")
        .bin_name("github")
        .show_download_progress(true)
        .current_version(cargo_crate_version!())
        .asset_match_fn(|release, target, identifier| {
            // custom matching logic here
            ...
        })
        .build()?
        .update()?;
    println!("Update status: `{}`!", status.version());
    Ok(())
}

Please let me know if this achieves what you were looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants