From d5fae932b846cbc967dec82da9b432334338c2a5 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 28 Mar 2024 21:43:19 +0900 Subject: [PATCH] Fix cargo-spellcheck installation (#428) --- CHANGELOG.md | 2 ++ manifests/cargo-spellcheck.json | 6 ++---- tools/codegen/base/cargo-spellcheck.json | 4 +--- tools/codegen/src/main.rs | 14 +++++++++----- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3dd4e8c..dbc6456d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com ## [Unreleased] +- Fix `cargo-spellcheck` installation bug. ([#428](https://github.com/taiki-e/install-action/pull/428)) + ## [2.31.1] - 2024-03-28 - Update `protoc@latest` to 3.26.1. diff --git a/manifests/cargo-spellcheck.json b/manifests/cargo-spellcheck.json index 19cef80c..8b3f19f7 100644 --- a/manifests/cargo-spellcheck.json +++ b/manifests/cargo-spellcheck.json @@ -2,12 +2,10 @@ "rust_crate": "cargo-spellcheck", "template": { "x86_64_linux_gnu": { - "url": "https://github.com/drahnr/cargo-spellcheck/releases/download/v${version}/cargo-spellcheck-v${version}-x86_64-unknown-linux-gnu", - "bin": "cargo-spellcheck-v${version}-x86_64-unknown-linux-gnu" + "url": "https://github.com/drahnr/cargo-spellcheck/releases/download/v${version}/cargo-spellcheck-v${version}-x86_64-unknown-linux-gnu" }, "x86_64_windows": { - "url": "https://github.com/drahnr/cargo-spellcheck/releases/download/v${version}/cargo-spellcheck-v${version}-x86_64-pc-windows-gnu.exe", - "bin": "cargo-spellcheck-v${version}-x86_64-pc-windows-gnu.exe" + "url": "https://github.com/drahnr/cargo-spellcheck/releases/download/v${version}/cargo-spellcheck-v${version}-x86_64-pc-windows-gnu.exe" } }, "latest": { diff --git a/tools/codegen/base/cargo-spellcheck.json b/tools/codegen/base/cargo-spellcheck.json index d4459d8b..63ea0e0d 100644 --- a/tools/codegen/base/cargo-spellcheck.json +++ b/tools/codegen/base/cargo-spellcheck.json @@ -3,12 +3,10 @@ "tag_prefix": "v", "rust_crate": "${package}", "asset_name": "${package}-v${version}-${rust_target}", - "bin": "${package}-v${version}-${rust_target}", "version_range": ">= 0.13", "platform": { "x86_64_windows": { - "asset_name": "${package}-v${version}-x86_64-pc-windows-gnu.exe", - "bin": "${package}-v${version}-x86_64-pc-windows-gnu.exe" + "asset_name": "${package}-v${version}-x86_64-pc-windows-gnu.exe" }, "x86_64_linux_gnu": {} } diff --git a/tools/codegen/src/main.rs b/tools/codegen/src/main.rs index b5d220c9..bdf09477 100644 --- a/tools/codegen/src/main.rs +++ b/tools/codegen/src/main.rs @@ -755,12 +755,16 @@ struct BaseManifest { } impl BaseManifest { fn validate(&self) { - if let Some(bin) = &self.bin { + for bin in self.bin.iter().chain(self.platform.values().flat_map(|m| &m.bin)) { assert!(!bin.as_slice().is_empty()); - } - for m in self.platform.values() { - if let Some(bin) = &m.bin { - assert!(!bin.as_slice().is_empty()); + for bin in bin.as_slice() { + let file_name = Path::new(bin).file_name().unwrap().to_str().unwrap(); + if !self.repository.ends_with("/xbuild") { + assert!( + !(file_name.contains("${version") || file_name.contains("${rust")), + "{bin}" + ); + } } } }