self_update
self_update copied to clipboard
How to refer to binary within a folder containing version and target triple inside archive?
Our current setup is like this:
rustic-v0.7.0-x86_64-pc-windows-msvc.tar.gz
├── rustic-v0.7.0-x86_64-pc-windows-msvc
├── config
│ ├── rustic.toml
├── rustic.exe
Checking target-arch... x86_64-pc-windows-msvc
Checking current version... v0.6.1
Checking latest released version... v0.7.0
New release found! v0.6.1 --> v0.7.0
New release is *NOT* compatible
rustic.exe release status:
* Current exe: "C:\\Users\\dailyuse\\.cargo\\bin\\rustic.exe"
* New exe release: "rustic-v0.7.0-x86_64-pc-windows-msvc.tar.gz"
* New exe download url: "https://api.github.com/repos/rustic-rs/rustic/releases/assets/149644039"
The new release will be downloaded/extracted and the existing binary will be replaced.
Do you want to continue? [Y/n] Y
Downloading...
[00:00:00] [========================================] 7.42 MiB/7.42 MiB (0s) Done
Extracting archive... error: UpdateError: Could not find the required path in the archive: "rustic.exe"
How can we self-update from that archive? We currently use:
let release = self_update::backends::github::Update::configure()
.repo_owner("rustic-rs")
.repo_name("rustic")
.bin_name("rustic")
.show_download_progress(true)
.current_version(current_version.to_string().as_str())
.no_confirm(self.force)
.build()?;
Replacing works, if we set it like this:
.bin_path_in_archive("rustic-v0.7.0-x86_64-pc-windows-msvc/rustic.exe")
.bin_name("rustic")
The problem is, that we can't know:
- which version the future release will have at that point in time
- and also it would need some logic I think, to account for the target-triple(?)
So how would it be best, to tackle this? 🤔 I'm wondering, if it would make sense, to introduce some basic templating for this, so we could write:
.bin_path_in_archive("{{ bin }}-v{{ version }}-{{ target }}/{{ bin }}.exe")