mirror of
https://github.com/taiki-e/install-action.git
synced 2026-04-09 18:11:48 +08:00
Add support for cargo-dinghy (#133)
This commit is contained in:
10
tools/codegen/base/cargo-dinghy.json
Normal file
10
tools/codegen/base/cargo-dinghy.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"repository": "https://github.com/sonos/dinghy",
|
||||
"tag_prefix": "",
|
||||
"asset_name": "${package}-${os_name}-${version}.tgz",
|
||||
"bin": "${package}-${version}/${package}${exe}",
|
||||
"platform": {
|
||||
"x86_64_linux_musl": {},
|
||||
"x86_64_macos": {}
|
||||
}
|
||||
}
|
||||
@@ -203,7 +203,7 @@ fn main() -> Result<()> {
|
||||
fs::File::open(download_cache)?.read_to_end(&mut buf)?;
|
||||
} else {
|
||||
download(&url)?.into_reader().read_to_end(&mut buf)?;
|
||||
eprintln!(" downloaded complete");
|
||||
eprintln!(" download complete");
|
||||
fs::write(download_cache, &buf)?;
|
||||
}
|
||||
eprintln!("getting sha256 hash for {url}");
|
||||
@@ -377,6 +377,7 @@ fn replace_vars(s: &str, package: &str, version: &str, platform: HostPlatform) -
|
||||
.replace("${package}", package)
|
||||
.replace("${tool}", package)
|
||||
.replace("${rust_target}", platform.rust_target())
|
||||
.replace("${os_name}", platform.os_name())
|
||||
.replace("${version}", version)
|
||||
.replace("${exe}", platform.exe_suffix());
|
||||
if s.contains('$') {
|
||||
@@ -698,6 +699,16 @@ impl HostPlatform {
|
||||
Self::aarch64_windows => "aarch64-pc-windows-msvc",
|
||||
}
|
||||
}
|
||||
fn os_name(self) -> &'static str {
|
||||
match self {
|
||||
Self::aarch64_linux_gnu
|
||||
| Self::aarch64_linux_musl
|
||||
| Self::x86_64_linux_gnu
|
||||
| Self::x86_64_linux_musl => "linux",
|
||||
Self::aarch64_macos | Self::x86_64_macos => "macos",
|
||||
Self::aarch64_windows | Self::x86_64_windows => "windows",
|
||||
}
|
||||
}
|
||||
fn exe_suffix(self) -> &'static str {
|
||||
match self {
|
||||
Self::x86_64_windows | Self::aarch64_windows => ".exe",
|
||||
|
||||
Reference in New Issue
Block a user