codegen: Exclude versions not released on crates.io from candidate for "latest"

This commit is contained in:
Taiki Endo
2025-04-04 07:26:58 +09:00
parent 95bd642ae8
commit 537312ee19
7 changed files with 18 additions and 13 deletions

View File

@@ -16,7 +16,9 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
- Update `release-plz@latest` to 0.3.130.
- Update `cargo-lambda@latest` to 1.8.2.
- Update `cargo-lambda@latest` to 1.8.1.
- Downgrade `cargo-spellcheck@latest` to 0.15.1. ([#932](https://github.com/taiki-e/install-action/pull/932))
## [2.49.43] - 2025-04-01

View File

@@ -20,13 +20,13 @@
},
"license_markdown": "[MIT](https://github.com/cargo-lambda/cargo-lambda/blob/main/LICENSE)",
"latest": {
"version": "1.8.2"
"version": "1.8.1"
},
"1": {
"version": "1.8.2"
"version": "1.8.1"
},
"1.8": {
"version": "1.8.2"
"version": "1.8.1"
},
"1.8.2": {
"x86_64_linux_musl": {

View File

@@ -10,10 +10,10 @@
},
"license_markdown": "[LGPLv2.1](https://github.com/drahnr/cargo-spellcheck/blob/master/LICENSE-LGPL)",
"latest": {
"version": "0.15.2"
"version": "0.15.1"
},
"0.15": {
"version": "0.15.2"
"version": "0.15.1"
},
"0.15.2": {
"x86_64_linux_gnu": {

View File

@@ -2775,7 +2775,7 @@
}
},
"0.22": {
"version": "0.22.1"
"version": "0.22.0"
},
"0.22.1": {
"x86_64_linux_gnu": {

2
manifests/zola.json generated
View File

@@ -1,5 +1,5 @@
{
"rust_crate": "zola",
"rust_crate": null,
"template": {
"x86_64_linux_gnu": {
"url": "https://github.com/getzola/zola/releases/download/v${version}/zola-v${version}-x86_64-unknown-linux-gnu.tar.gz"

View File

@@ -1,7 +1,6 @@
{
"repository": "https://github.com/getzola/zola",
"tag_prefix": "v",
"rust_crate": "${package}",
"asset_name": "${package}-v${version}-${rust_target}.tar.gz",
"platform": {
"x86_64_linux_gnu": {},

View File

@@ -490,12 +490,14 @@ fn main() -> Result<()> {
if let Some(crates_io_info) = &crates_io_info {
if let Some(v) = crates_io_info.versions.iter().find(|v| v.num == *version) {
if v.yanked {
continue;
continue; // Exclude yanked version from candidate for "latest".
}
} else {
continue; // Exclude version not released on crates.io from candidate for "latest".
}
}
if base_info.broken.contains(version) {
continue;
continue; // Exclude version marked as broken from candidate for "latest".
}
if !(version.major == 0 && version.minor == 0) {
manifests.map.insert(
@@ -618,15 +620,17 @@ fn replace_vars(
platform: Option<HostPlatform>,
rust_crate: Option<&str>,
) -> Result<String> {
const RUST_SPECIFIC: &[(&str, fn(HostPlatform) -> &'static str)] = &[
static RUST_SPECIFIC: &[(&str, fn(HostPlatform) -> &'static str)] = &[
("${rust_target}", HostPlatform::rust_target),
("${rust_target_arch}", HostPlatform::rust_target_arch),
("${rust_target_os}", HostPlatform::rust_target_os),
];
// zola is Rust crate, but is not released on crates.io.
static KNOWN_RUST_CRATE_NOT_IN_CRATES_IO: &[&str] = &["zola"];
let mut s = s.replace("${package}", package).replace("${tool}", package);
if let Some(platform) = platform {
s = s.replace("${exe}", platform.exe_suffix());
if rust_crate.is_some() {
if rust_crate.is_some() || KNOWN_RUST_CRATE_NOT_IN_CRATES_IO.contains(&package) {
for &(var, f) in RUST_SPECIFIC {
s = s.replace(var, f(platform));
}