Compare commits

...

17 Commits

Author SHA1 Message Date
Taiki Endo
9fa9fafb73 Release 2.3.2 2023-01-20 10:27:59 +09:00
Taiki Endo
ad042ad7b1 Update just@latest to 1.12.0 2023-01-20 10:22:34 +09:00
Taiki Endo
a085553f57 Update cargo-no-dev-deps@latest to 0.2.0 2023-01-20 10:22:34 +09:00
Taiki Endo
06af96936d Update cspell dictionary 2023-01-19 01:57:13 +09:00
Taiki Endo
0b8b246f3d Set rust-related env vars for building codegen in CI 2023-01-18 22:10:38 +09:00
Taiki Endo
9b917368c2 clippy: Set avoid-breaking-exported-api = false 2023-01-18 21:59:47 +09:00
Taiki Endo
67f0979373 Release 2.3.1 2023-01-18 11:15:19 +09:00
Taiki Endo
e74b1e0d86 Update dprint@latest to 0.34.4 2023-01-18 11:14:22 +09:00
Taiki Endo
46d672f17d Update cargo-binstall@latest to 0.19.3 2023-01-18 11:14:22 +09:00
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
12 changed files with 190 additions and 68 deletions

1
.clippy.toml Normal file
View File

@@ -0,0 +1 @@
avoid-breaking-exported-api = false

View File

@@ -79,15 +79,20 @@ xous
// Rust other
alloc
bools
builtins
canonicalize
consts
deque
doctest
hasher
impls
inlateout
intrinsics
lateout
msrv
nomem
nostack
peekable
punct
repr
@@ -99,16 +104,19 @@ supertrait
supertraits
toolchains
uninit
unsized
upcastable
// Other
connrefused
cygwin
dpkg
euxo
msys
noninteractive
noprofile
norc
nproc
pipefail
powerset
proto

View File

@@ -3,7 +3,6 @@ bytecodealliance
coreutils
distro
doas
Dpkg
dprint
enablerepo
epel
@@ -26,4 +25,5 @@ shellcheck
shfmt
udeps
wasmtime
watchexec
xscale

View File

@@ -13,6 +13,15 @@ on:
- cron: '0 1 * * *'
workflow_dispatch:
env:
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10
defaults:
run:
shell: bash
@@ -29,21 +38,21 @@ jobs:
- ubuntu-20.04
- ubuntu-22.04
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.
- 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:
# Note: Specifying the version of valgrind and cargo-binstall is not supported.
- 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
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
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
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
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 }}
timeout-minutes: 60
steps:
@@ -77,20 +86,20 @@ jobs:
- rockylinux:8-minimal # glibc 2.28
tool:
# 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:
- container: ubuntu:22.04 # glibc 2.35
# 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)
# 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
# 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
# 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,watchexec-cli
- 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.
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
timeout-minutes: 60
container: ${{ matrix.container }}

View File

@@ -10,6 +10,24 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [Unreleased]
## [2.3.2] - 2023-01-20
- Update `just@latest` to 1.12.0.
- Update `cargo-no-dev-deps@latest` to 0.2.0.
## [2.3.1] - 2023-01-18
- Update `dprint@latest` to 0.34.4.
- Update `cargo-binstall@latest` to 0.19.3.
## [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.
@@ -559,7 +577,10 @@ Note: This release is considered a breaking change because installing on version
Initial release
[Unreleased]: https://github.com/taiki-e/install-action/compare/v2.2.3...HEAD
[Unreleased]: https://github.com/taiki-e/install-action/compare/v2.3.2...HEAD
[2.3.2]: https://github.com/taiki-e/install-action/compare/v2.3.1...v2.3.2
[2.3.1]: https://github.com/taiki-e/install-action/compare/v2.3.0...v2.3.1
[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.1]: https://github.com/taiki-e/install-action/compare/v2.2.0...v2.2.1

View File

@@ -25,6 +25,8 @@ GitHub Action for installing development tools (mainly from GitHub Releases).
### Example workflow
To install the latest version:
```yaml
- uses: taiki-e/install-action@v2
with:
@@ -118,7 +120,7 @@ See the linked documentation for information on security when installed using [s
## Compatibility
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
- 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
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() {
if type -P sudo &>/dev/null; then
retry sudo apt-get -o Acquire::Retries=10 -qq update
@@ -311,6 +295,11 @@ sys_install() {
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
bail "invalid argument '$1'"
fi
@@ -425,6 +414,7 @@ if ! type -P jq &>/dev/null || ! type -P curl &>/dev/null || ! type -P tar &>/de
esac
fi
unsupported_tools=()
for tool in "${tools[@]}"; do
if [[ "${tool}" == *"@"* ]]; then
version="${tool#*@}"
@@ -438,9 +428,9 @@ for tool in "${tools[@]}"; do
else
version="latest"
fi
info "installing ${tool}@${version}"
case "${tool}" in
protoc)
info "installing ${tool}@${version}"
read_manifest "protoc" "${version}"
# Copying files to /usr/local/include requires sudo, so do not use it.
bin_dir="${HOME}/.install-action/bin"
@@ -475,6 +465,7 @@ for tool in "${tools[@]}"; do
rm -rf "${tmp_dir}"
;;
valgrind)
info "installing ${tool}@${version}"
case "${version}" in
latest) ;;
*) 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
;;
cargo-binstall)
info "installing ${tool}@${version}"
case "${version}" in
latest) ;;
*) 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.
if [[ ! -f "${manifest_dir}/${tool}.json" ]]; then
cargo_binstall "${tool}" "${version}"
echo
case "${version}" in
latest) unsupported_tools+=("${tool}") ;;
*) unsupported_tools+=("${tool}@${version}") ;;
esac
continue
fi
info "installing ${tool}@${version}"
# Pre-install
case "${tool}" in
shellcheck)
@@ -538,3 +534,14 @@ for tool in "${tools[@]}"; do
esac
echo
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": {
"version": "0.19.1"
"version": "0.19.3"
},
"0.19.1": {
"0.19.3": {
"x86_64_linux_musl": {
"checksum": "b270f25fd21fe27b99b99cb4f6dd5ed98ec01284cf450994974f632c77a823a8"
"checksum": "da46fac978af7d86820d1b6bbd14cfd10187bc25ac14c0236d3de8da7d92a183"
},
"x86_64_macos": {
"checksum": "dd46485e17b12211684fcb3e55e966f9f4cb75c14bb715f6c905373640e98a4e"
"checksum": "237a702ac2ee3130bff3624a7296ec471c6b6ff45cc29af30216b50f2124af5d"
},
"x86_64_windows": {
"checksum": "b120023e546562bfea5ca4ef1a3b67fc6571968ae459a34aa0b4414eff38f5e3"
"checksum": "053a32c20f44439366fdff80f5106097d6c3d128cb436cb0f425f32ed608d78b"
},
"aarch64_linux_musl": {
"checksum": "98264b5342db7a7b68d215d105a42a81961de02743b8c369b476dc892d12f2fa"
"checksum": "be6c2542f093f393aa72734c96b12a353ec94232afba86fa6e93f25ed6d0669e"
},
"aarch64_macos": {
"checksum": "dd099af7147d856bcf6cc713c1bf53c4be003f597f92fe9c2e3a58d0ad7d6fd2"
"checksum": "ba01100fbd810977b4e12deddfaab0516acc96cded05e00ccb4acfcab7d67f7c"
},
"aarch64_windows": {
"checksum": "ed5023a73f3bb8a8b8fb80e5a7476cab2487d7e16ed3fe04b51cf25ec1644d92"
"checksum": "22aa13d36cba7d1aee1a531bed53374c6ed3d02daf542fd65eee3c5dad700bc8"
}
}
}

View File

@@ -20,7 +20,30 @@
}
},
"latest": {
"version": "0.1.0"
"version": "0.2.0"
},
"0.2": {
"version": "0.2.0"
},
"0.2.0": {
"x86_64_linux_musl": {
"checksum": "446d7879e260d1a6170ee105c211255e0729d2db50d4d6378c60ebc19b26b056"
},
"x86_64_macos": {
"checksum": "7eb91033a29c16c02a67162858adcd592804b3f393b981a3f0e00c1c3ce7a29c"
},
"x86_64_windows": {
"checksum": "aa49deac93a3bf7d29809f5b687e1e39ad5dcb21d7f227c9690a400846dda144"
},
"aarch64_linux_musl": {
"checksum": "085738eb7b1377034c2f569bd6a6402499a1f2e71d5e89bccaa5d85303c32627"
},
"aarch64_macos": {
"checksum": "9854154d4f044807dd1ad06c9b2a94f93e0f8551f44c90cab1a955eb909457a2"
},
"aarch64_windows": {
"checksum": "8fafabd875be78457349ad2c860793d28a92efaf881de16fcda3e68bf9286baf"
}
},
"0.1": {
"version": "0.1.0"

View File

@@ -20,10 +20,44 @@
}
},
"latest": {
"version": "0.34.1"
"version": "0.34.4"
},
"0.34": {
"version": "0.34.1"
"version": "0.34.4"
},
"0.34.4": {
"x86_64_linux_musl": {
"checksum": "088d41a1b13b4623148119af9a3c2f618794170484294c210d5acd64f94a5cc6"
},
"x86_64_macos": {
"checksum": "74a1751e335ffde8385fb415365290b81d26f3509007a0cead1f62f8bb6d0e37"
},
"x86_64_windows": {
"checksum": "209e751b693f1c076fbd3d204af01bcb5c10be3f9dd99106bd14145e98de01fc"
},
"aarch64_linux_gnu": {
"checksum": "80607da90a920448d4361ad4993f7c5e770f3e8b6062d492ac00dd2eb558f256"
},
"aarch64_macos": {
"checksum": "bb052fa8f0cc995c09563adb07fb554a5386c2ed1152ba97a76734ed6ac55c4e"
}
},
"0.34.2": {
"x86_64_linux_musl": {
"checksum": "aee0a7ee92e67b9cc3d8d215dce4e0985c1239a1e674fbb987ac9e719f969ac8"
},
"x86_64_macos": {
"checksum": "5127902352952d5d913aafa16b65a52d3dd7b10f2f0f8c984b2d177f427f6c73"
},
"x86_64_windows": {
"checksum": "fdcb3c85e11b90ad18f2a967af6a259c881adbd895582a675ab5fd87798d05b4"
},
"aarch64_linux_gnu": {
"checksum": "507541fb2580113e2933ea34c5afe28bfb82cfb61650fa05827dd8c9981242da"
},
"aarch64_macos": {
"checksum": "038f0d391fdcf33214f0cd2793377c5673a39ebf8ff3a19225afd320efb0f8a2"
}
},
"0.34.1": {
"x86_64_linux_musl": {

View File

@@ -17,10 +17,30 @@
}
},
"latest": {
"version": "1.11.0"
"version": "1.12.0"
},
"1": {
"version": "1.11.0"
"version": "1.12.0"
},
"1.12": {
"version": "1.12.0"
},
"1.12.0": {
"x86_64_linux_musl": {
"checksum": "a8e1278f3a2c81384f9a146e74fc40b5204f00776cccfb4da4d36e45716546d4"
},
"x86_64_macos": {
"checksum": "22eeed0bcff05f5cd280345b611a9950b81c3a5b4cabb925cf5c0c77475b2dfd"
},
"x86_64_windows": {
"checksum": "a19d34d8b08e08a2d5b6839db6ece5bfd05faefa45b8924ecbe93f07d3e86e76"
},
"aarch64_linux_musl": {
"checksum": "a8f990336308179103c7776b463f89d751d7c910b757765dd47713b4a32b93a1"
},
"aarch64_macos": {
"checksum": "d08bcc10a690fed8db84e7a64c8665e69d56ad601a85fa970f0a82bee23ec204"
}
},
"1.11": {
"version": "1.11.0"

View File

@@ -40,7 +40,7 @@ fn main() -> Result<()> {
.strip_prefix("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![];
// GitHub API returns up to 100 results at a time. If the number of releases
// is greater than 100, multiple fetches are needed.
@@ -56,13 +56,17 @@ fn main() -> Result<()> {
}
releases.append(&mut r);
}
let releases: Vec<_> = releases
let releases: BTreeMap<_, _> = releases
.iter()
.filter_map(|release| {
release
.tag_name
.strip_prefix(&base_info.tag_prefix)
.map(|version| (version, release))
let version = release.tag_name.strip_prefix(&base_info.tag_prefix)?;
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();
}
}
Some((Reverse(semver_version.ok()?), (version, release)))
})
.collect();
@@ -112,13 +116,15 @@ fn main() -> Result<()> {
ManifestRef::Real(_) => &m.0 .0,
};
if !manifests.map.is_empty()
&& *version == releases.first().unwrap().0.parse()?
&& *version >= releases.first_key_value().unwrap().0 .0.clone().into()
{
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 {
Some(version_range) => Some(version_range.parse()?),
@@ -137,7 +143,7 @@ fn main() -> Result<()> {
let req = if version_req == "latest" {
if manifests.map.is_empty() {
format!("={}", releases.first().unwrap().0).parse()?
format!("={}", releases.first_key_value().unwrap().0 .0).parse()?
} else {
format!(">{}", semver_versions.last().unwrap()).parse()?
}
@@ -150,18 +156,9 @@ fn main() -> Result<()> {
};
let mut buf = vec![];
for &(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;
};
for (Reverse(semver_version), (version, release)) in &releases {
if let Some(version_req) = &version_req {
if !version_req.matches(&semver_version) {
if !version_req.matches(semver_version) {
continue;
}
}