Compare commits

...

10 Commits

Author SHA1 Message Date
Taiki Endo
06dac1bb47 Release 2.3.0 2023-01-16 23:04:34 +09:00
Taiki Endo
a3609ab69a Tweak docs 2023-01-16 23:03:45 +09:00
Taiki Endo
8b9de1e094 Update changelog 2023-01-16 20:31:06 +09:00
Taiki Endo
2ed407fd17 codegen: Sort releases returned from GitHub API 2023-01-16 20:24:12 +09:00
Taiki Endo
ad8540ac77 Use cargo-binstall batching mode (#54) 2023-01-16 19:56:58 +09:00
Taiki Endo
b95ae1b223 Set CARGO_NET_RETRY and RUSTUP_MAX_RETRIES 2023-01-16 19:45:56 +09:00
Taiki Endo
c1300c3f7c Update cargo-binstall@latest to 0.19.2 2023-01-16 14:06:10 +09:00
Taiki Endo
bbd2d52c58 Update readme 2023-01-16 09:19:14 +09:00
Taiki Endo
ce26f7e3c8 Release 2.2.3 2023-01-16 09:14:31 +09:00
Taiki Endo
92ab599e22 Update cargo-llvm-cov@latest to 0.5.9 2023-01-16 09:13:46 +09:00
8 changed files with 100 additions and 64 deletions

View File

@@ -26,4 +26,5 @@ shellcheck
shfmt shfmt
udeps udeps
wasmtime wasmtime
watchexec
xscale xscale

View File

@@ -29,21 +29,21 @@ jobs:
- ubuntu-20.04 - ubuntu-20.04
- ubuntu-22.04 - ubuntu-22.04
tool: tool:
# cargo-watch is supported by cargo-binstall (through quickinstall) # cargo-watch/watchexec-cli is supported by cargo-binstall (through quickinstall)
# TODO: valgrind installation sometime hangs. # TODO: valgrind installation sometime hangs.
- cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov - cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli
include: include:
# Note: Specifying the version of valgrind and cargo-binstall is not supported. # Note: Specifying the version of valgrind and cargo-binstall is not supported.
- os: ubuntu-20.04 - os: ubuntu-20.04
tool: cargo-hack@0.5.24,cargo-llvm-cov@0.5.3,cargo-minimal-versions@0.1.8,cargo-no-dev-deps@0.1.0,parse-changelog@0.5.2,cargo-udeps@0.1.35,cargo-valgrind@2.1.0,cargo-deny@0.13.5,cross@0.2.4,dprint@0.34.1,just@1.9.0,nextest@0.9.11,protoc@3.21.12,shellcheck@0.9.0,shfmt@3.6.0,wasm-pack@0.10.3,wasmtime@4.0.0,mdbook@0.4.25,mdbook-linkcheck@0.7.7,cargo-watch@8.1.1,grcov@0.8.13 tool: cargo-hack@0.5.24,cargo-llvm-cov@0.5.3,cargo-minimal-versions@0.1.8,cargo-no-dev-deps@0.1.0,parse-changelog@0.5.2,cargo-udeps@0.1.35,cargo-valgrind@2.1.0,cargo-deny@0.13.5,cross@0.2.4,dprint@0.34.1,just@1.9.0,nextest@0.9.11,protoc@3.21.12,shellcheck@0.9.0,shfmt@3.6.0,wasm-pack@0.10.3,wasmtime@4.0.0,mdbook@0.4.25,mdbook-linkcheck@0.7.7,cargo-watch@8.1.1,grcov@0.8.13,watchexec-cli@1.20.5
- os: ubuntu-20.04 - os: ubuntu-20.04
tool: cargo-hack@0.5,cargo-llvm-cov@0.5,cargo-minimal-versions@0.1,cargo-no-dev-deps@0.1,parse-changelog@0.5,cargo-udeps@0.1,cargo-valgrind@2.1,cargo-deny@0.13,cross@0.2,dprint@0.34,just@1.9,nextest@0.9,protoc@3.21,shellcheck@0.9,shfmt@3.5,wasm-pack@0.10,wasmtime@4.0,mdbook@0.4,mdbook-linkcheck@0.7,cargo-watch@8.1,grcov@0.8 tool: cargo-hack@0.5,cargo-llvm-cov@0.5,cargo-minimal-versions@0.1,cargo-no-dev-deps@0.1,parse-changelog@0.5,cargo-udeps@0.1,cargo-valgrind@2.1,cargo-deny@0.13,cross@0.2,dprint@0.34,just@1.9,nextest@0.9,protoc@3.21,shellcheck@0.9,shfmt@3.5,wasm-pack@0.10,wasmtime@4.0,mdbook@0.4,mdbook-linkcheck@0.7,cargo-watch@8.1,grcov@0.8,watchexec-cli@1.20
- os: ubuntu-20.04 - os: ubuntu-20.04
tool: cargo-valgrind@2,just@1,protoc@3,shfmt@3,wasmtime@4,cargo-watch@8 tool: cargo-valgrind@2,just@1,protoc@3,shfmt@3,wasmtime@4,cargo-watch@8,watchexec-cli@1
- os: macos-11 - os: macos-11
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli
- os: windows-2019 - os: windows-2019
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
@@ -77,20 +77,20 @@ jobs:
- rockylinux:8-minimal # glibc 2.28 - rockylinux:8-minimal # glibc 2.28
tool: tool:
# valgrind: installing snap to container is difficult... # valgrind: installing snap to container is difficult...
- cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov - cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli
include: include:
- container: ubuntu:22.04 # glibc 2.35 - container: ubuntu:22.04 # glibc 2.35
# cargo-udeps depends on openssl 1.1 # cargo-udeps depends on openssl 1.1
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli
- container: fedora:latest # glibc 2.36 (as of fedora 37) - container: fedora:latest # glibc 2.36 (as of fedora 37)
# cargo-udeps depends on openssl 1.1 # cargo-udeps depends on openssl 1.1
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli
- container: centos:7 # glibc 2.17 - container: centos:7 # glibc 2.17
# cargo-udeps,protoc,valgrind,wasmtime,mdbook-linkcheck,cargo-watch don't provide prebuilt binaries for musl host. # cargo-udeps,protoc,valgrind,wasmtime,mdbook-linkcheck,cargo-watch don't provide prebuilt binaries for musl or old glibc host.
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall,grcov tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall,grcov,watchexec-cli
- container: alpine:latest # musl 1.2.3 (as of alpine 3.17) - container: alpine:latest # musl 1.2.3 (as of alpine 3.17)
# cargo-udeps,protoc,valgrind,wasmtime,mdbook-linkcheck,cargo-watch don't provide prebuilt binaries for musl host. # cargo-udeps,protoc,valgrind,wasmtime,mdbook-linkcheck,cargo-watch don't provide prebuilt binaries for musl host.
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall,grcov tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall,grcov,watchexec-cli
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
container: ${{ matrix.container }} container: ${{ matrix.container }}

View File

@@ -10,6 +10,16 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [Unreleased] ## [Unreleased]
## [2.3.0] - 2023-01-16
- Update `cargo-binstall@latest` to 0.19.2.
- Use `cargo-binstall` batching mode (#54)
## [2.2.3] - 2023-01-16
- Update `cargo-llvm-cov@latest` to 0.5.9.
## [2.2.2] - 2023-01-15 ## [2.2.2] - 2023-01-15
- Update `cargo-llvm-cov@latest` to 0.5.8. - Update `cargo-llvm-cov@latest` to 0.5.8.
@@ -555,7 +565,9 @@ Note: This release is considered a breaking change because installing on version
Initial release Initial release
[Unreleased]: https://github.com/taiki-e/install-action/compare/v2.2.2...HEAD [Unreleased]: https://github.com/taiki-e/install-action/compare/v2.3.0...HEAD
[2.3.0]: https://github.com/taiki-e/install-action/compare/v2.2.3...v2.3.0
[2.2.3]: https://github.com/taiki-e/install-action/compare/v2.2.2...v2.2.3
[2.2.2]: https://github.com/taiki-e/install-action/compare/v2.2.1...v2.2.2 [2.2.2]: https://github.com/taiki-e/install-action/compare/v2.2.1...v2.2.2
[2.2.1]: https://github.com/taiki-e/install-action/compare/v2.2.0...v2.2.1 [2.2.1]: https://github.com/taiki-e/install-action/compare/v2.2.0...v2.2.1
[2.2.0]: https://github.com/taiki-e/install-action/compare/v2.1.4...v2.2.0 [2.2.0]: https://github.com/taiki-e/install-action/compare/v2.1.4...v2.2.0

View File

@@ -25,6 +25,8 @@ GitHub Action for installing development tools (mainly from GitHub Releases).
### Example workflow ### Example workflow
To install the latest version:
```yaml ```yaml
- uses: taiki-e/install-action@v2 - uses: taiki-e/install-action@v2
with: with:
@@ -118,7 +120,7 @@ See the linked documentation for information on security when installed using [s
## Compatibility ## Compatibility
This action has been tested for GitHub-hosted runners (Ubuntu, macOS, Windows) and containers (Ubuntu, Debian, Alpine, Fedora, CentOS, Rocky). This action has been tested for GitHub-hosted runners (Ubuntu, macOS, Windows) and containers (Ubuntu, Debian, Alpine, Fedora, CentOS, Rocky).
To use this action in self-hosted runners or in containers, you will need to install at least the following: To use this action in self-hosted runners or in containers, at least the following tools are required:
- bash - bash
- cargo (if you install cargo subcommands or use cargo-binstall fallback) - cargo (if you install cargo subcommands or use cargo-binstall fallback)

45
main.sh
View File

@@ -241,22 +241,6 @@ install_cargo_binstall() {
x cargo binstall -V x cargo binstall -V
fi fi
} }
cargo_binstall() {
local tool="$1"
local version="$2"
info "install-action does not support ${tool}, fallback to cargo-binstall"
install_cargo_binstall
# By default, cargo-binstall enforce downloads over secure transports only.
# As a result, http will be disabled, and it will also set
# min tls version to be 1.2
case "${version}" in
latest) cargo binstall --force --no-confirm "${tool}" ;;
*) cargo binstall --force --no-confirm --version "${version}" "${tool}" ;;
esac
}
apt_update() { apt_update() {
if type -P sudo &>/dev/null; then if type -P sudo &>/dev/null; then
retry sudo apt-get -o Acquire::Retries=10 -qq update retry sudo apt-get -o Acquire::Retries=10 -qq update
@@ -311,6 +295,11 @@ sys_install() {
esac esac
} }
# cargo-binstall may call `cargo install` on their fallback: https://github.com/taiki-e/install-action/pull/54#issuecomment-1383140833
# cross calls rustup on `cross --version` if the current directly is cargo workspace.
export CARGO_NET_RETRY=10
export RUSTUP_MAX_RETRIES=10
if [[ $# -gt 0 ]]; then if [[ $# -gt 0 ]]; then
bail "invalid argument '$1'" bail "invalid argument '$1'"
fi fi
@@ -425,6 +414,7 @@ if ! type -P jq &>/dev/null || ! type -P curl &>/dev/null || ! type -P tar &>/de
esac esac
fi fi
unsupported_tools=()
for tool in "${tools[@]}"; do for tool in "${tools[@]}"; do
if [[ "${tool}" == *"@"* ]]; then if [[ "${tool}" == *"@"* ]]; then
version="${tool#*@}" version="${tool#*@}"
@@ -438,9 +428,9 @@ for tool in "${tools[@]}"; do
else else
version="latest" version="latest"
fi fi
info "installing ${tool}@${version}"
case "${tool}" in case "${tool}" in
protoc) protoc)
info "installing ${tool}@${version}"
read_manifest "protoc" "${version}" read_manifest "protoc" "${version}"
# Copying files to /usr/local/include requires sudo, so do not use it. # Copying files to /usr/local/include requires sudo, so do not use it.
bin_dir="${HOME}/.install-action/bin" bin_dir="${HOME}/.install-action/bin"
@@ -475,6 +465,7 @@ for tool in "${tools[@]}"; do
rm -rf "${tmp_dir}" rm -rf "${tmp_dir}"
;; ;;
valgrind) valgrind)
info "installing ${tool}@${version}"
case "${version}" in case "${version}" in
latest) ;; latest) ;;
*) warn "specifying the version of ${tool} is not supported yet by this action" ;; *) warn "specifying the version of ${tool} is not supported yet by this action" ;;
@@ -491,6 +482,7 @@ for tool in "${tools[@]}"; do
snap_install valgrind --classic snap_install valgrind --classic
;; ;;
cargo-binstall) cargo-binstall)
info "installing ${tool}@${version}"
case "${version}" in case "${version}" in
latest) ;; latest) ;;
*) warn "specifying the version of ${tool} is not supported by this action" ;; *) warn "specifying the version of ${tool} is not supported by this action" ;;
@@ -507,11 +499,15 @@ for tool in "${tools[@]}"; do
# Use cargo-binstall fallback if tool is not available. # Use cargo-binstall fallback if tool is not available.
if [[ ! -f "${manifest_dir}/${tool}.json" ]]; then if [[ ! -f "${manifest_dir}/${tool}.json" ]]; then
cargo_binstall "${tool}" "${version}" case "${version}" in
echo latest) unsupported_tools+=("${tool}") ;;
*) unsupported_tools+=("${tool}@${version}") ;;
esac
continue continue
fi fi
info "installing ${tool}@${version}"
# Pre-install # Pre-install
case "${tool}" in case "${tool}" in
shellcheck) shellcheck)
@@ -538,3 +534,14 @@ for tool in "${tools[@]}"; do
esac esac
echo echo
done done
if [[ ${#unsupported_tools[@]} -gt 0 ]]; then
IFS=$','
info "install-action does not support ${unsupported_tools[*]}; fallback to cargo-binstall"
IFS=$'\n\t'
install_cargo_binstall
# By default, cargo-binstall enforce downloads over secure transports only.
# As a result, http will be disabled, and it will also set
# min tls version to be 1.2
cargo binstall --force --no-confirm "${unsupported_tools[@]}"
fi

View File

@@ -20,26 +20,26 @@
} }
}, },
"latest": { "latest": {
"version": "0.19.1" "version": "0.19.2"
}, },
"0.19.1": { "0.19.2": {
"x86_64_linux_musl": { "x86_64_linux_musl": {
"checksum": "b270f25fd21fe27b99b99cb4f6dd5ed98ec01284cf450994974f632c77a823a8" "checksum": "7fba5db9c86abb6bfcc777130b2f113b0e4bf4acfd8bfc23b784e1a78426e4e2"
}, },
"x86_64_macos": { "x86_64_macos": {
"checksum": "dd46485e17b12211684fcb3e55e966f9f4cb75c14bb715f6c905373640e98a4e" "checksum": "def2312b8fb67119329c6ae6b11d772f0cf087a17f2e8453d87e814d0aee7078"
}, },
"x86_64_windows": { "x86_64_windows": {
"checksum": "b120023e546562bfea5ca4ef1a3b67fc6571968ae459a34aa0b4414eff38f5e3" "checksum": "794fc6834f27c8882d2a777df176448039824e16b85c0c3641c26bd176ebc50a"
}, },
"aarch64_linux_musl": { "aarch64_linux_musl": {
"checksum": "98264b5342db7a7b68d215d105a42a81961de02743b8c369b476dc892d12f2fa" "checksum": "70191222ad486cf0c15e6679346ba7f3afbc2c1818213d6f8712a2457ebde4e1"
}, },
"aarch64_macos": { "aarch64_macos": {
"checksum": "dd099af7147d856bcf6cc713c1bf53c4be003f597f92fe9c2e3a58d0ad7d6fd2" "checksum": "67c4787ca667ef93ed4bbfc967988272dfad53e3dfaf090f4d629b33d25fa778"
}, },
"aarch64_windows": { "aarch64_windows": {
"checksum": "ed5023a73f3bb8a8b8fb80e5a7476cab2487d7e16ed3fe04b51cf25ec1644d92" "checksum": "c73162dbe22e28746e29eb49f9b2e309867d3d698c8b777e91b2771a369af38c"
} }
} }
} }

View File

@@ -17,10 +17,27 @@
} }
}, },
"latest": { "latest": {
"version": "0.5.8" "version": "0.5.9"
}, },
"0.5": { "0.5": {
"version": "0.5.8" "version": "0.5.9"
},
"0.5.9": {
"x86_64_linux_musl": {
"checksum": "aadde3416c86403f72986f6c68001d2a46497ee8892f5affdb6b681213b586a2"
},
"x86_64_macos": {
"checksum": "7f7d17223237cc2ea65a4cd2d3ea0f0868711bd44dd56ee35839b41202b08685"
},
"x86_64_windows": {
"checksum": "efd986565868a0f1a255af9b913e77b95eb77b49940a93dde4e2c88874f2da39"
},
"aarch64_linux_musl": {
"checksum": "d6d539c038a07c12e04954af3357afadadf92ca3eacf5a155eb555b47d3b1ca4"
},
"aarch64_macos": {
"checksum": "4a023a922507d8a63424cb4b3d98c695fc2a66f8596b1e93b3a573afc2a384c5"
}
}, },
"0.5.8": { "0.5.8": {
"x86_64_linux_musl": { "x86_64_linux_musl": {

View File

@@ -40,7 +40,7 @@ fn main() -> Result<()> {
.strip_prefix("https://github.com/") .strip_prefix("https://github.com/")
.context("repository must be starts with https://github.com/")?; .context("repository must be starts with https://github.com/")?;
eprintln!("downloading releases of https://github.com/{repo}"); eprintln!("downloading releases of https://github.com/{repo} from https://api.github.com/repos/{repo}/releases");
let mut releases: github::Releases = vec![]; let mut releases: github::Releases = vec![];
// GitHub API returns up to 100 results at a time. If the number of releases // GitHub API returns up to 100 results at a time. If the number of releases
// is greater than 100, multiple fetches are needed. // is greater than 100, multiple fetches are needed.
@@ -56,13 +56,17 @@ fn main() -> Result<()> {
} }
releases.append(&mut r); releases.append(&mut r);
} }
let releases: Vec<_> = releases let releases: BTreeMap<_, _> = releases
.iter() .iter()
.filter_map(|release| { .filter_map(|release| {
release let version = release.tag_name.strip_prefix(&base_info.tag_prefix)?;
.tag_name let mut semver_version = version.parse::<semver::Version>();
.strip_prefix(&base_info.tag_prefix) if semver_version.is_err() {
.map(|version| (version, release)) if let Some(default_major_version) = &base_info.default_major_version {
semver_version = format!("{default_major_version}.{version}").parse();
}
}
Some((Reverse(semver_version.ok()?), (version, release)))
}) })
.collect(); .collect();
@@ -112,13 +116,15 @@ fn main() -> Result<()> {
ManifestRef::Real(_) => &m.0 .0, ManifestRef::Real(_) => &m.0 .0,
}; };
if !manifests.map.is_empty() if !manifests.map.is_empty()
&& *version == releases.first().unwrap().0.parse()? && *version >= releases.first_key_value().unwrap().0 .0.clone().into()
{ {
return Ok(()); return Ok(());
} }
} }
} }
Some(format!("={}", releases.first().unwrap().0).parse()?) let req = format!("={}", releases.first_key_value().unwrap().0 .0).parse()?;
eprintln!("update manifest for versions '{req}'");
Some(req)
} }
None => match base_info.version_range { None => match base_info.version_range {
Some(version_range) => Some(version_range.parse()?), Some(version_range) => Some(version_range.parse()?),
@@ -137,7 +143,7 @@ fn main() -> Result<()> {
let req = if version_req == "latest" { let req = if version_req == "latest" {
if manifests.map.is_empty() { if manifests.map.is_empty() {
format!("={}", releases.first().unwrap().0).parse()? format!("={}", releases.first_key_value().unwrap().0 .0).parse()?
} else { } else {
format!(">{}", semver_versions.last().unwrap()).parse()? format!(">{}", semver_versions.last().unwrap()).parse()?
} }
@@ -150,18 +156,9 @@ fn main() -> Result<()> {
}; };
let mut buf = vec![]; let mut buf = vec![];
for &(version, release) in &releases { for (Reverse(semver_version), (version, release)) in &releases {
let mut semver_version = version.parse::<semver::Version>();
if semver_version.is_err() {
if let Some(default_major_version) = &base_info.default_major_version {
semver_version = format!("{default_major_version}.{version}").parse();
}
}
let Ok(semver_version) = semver_version else {
continue;
};
if let Some(version_req) = &version_req { if let Some(version_req) = &version_req {
if !version_req.matches(&semver_version) { if !version_req.matches(semver_version) {
continue; continue;
} }
} }