mirror of
https://github.com/taiki-e/install-action.git
synced 2026-04-29 10:30:23 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23db74cab2 | ||
|
|
b95243b2fd | ||
|
|
804d0fbae7 | ||
|
|
c92f25fe23 | ||
|
|
771bd4fef9 | ||
|
|
dd213e8db4 | ||
|
|
63b321e245 | ||
|
|
f8eeeb3526 |
3
.github/dependabot.yml
vendored
3
.github/dependabot.yml
vendored
@@ -6,6 +6,9 @@ updates:
|
||||
interval: daily
|
||||
commit-message:
|
||||
prefix: ''
|
||||
ignore:
|
||||
# https://github.com/taiki-e/install-action/pull/831#issuecomment-2650284580
|
||||
- dependency-name: ureq
|
||||
labels: []
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
|
||||
11
CHANGELOG.md
11
CHANGELOG.md
@@ -10,6 +10,14 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.48.8] - 2025-02-11
|
||||
|
||||
- Update `cargo-no-dev-deps@latest` to 0.2.15.
|
||||
|
||||
- Update `cargo-minimal-versions@latest` to 0.1.30.
|
||||
|
||||
- Update `cargo-hack@latest` to 0.6.35.
|
||||
|
||||
## [2.48.7] - 2025-02-10
|
||||
|
||||
- Update `cargo-nextest@latest` to 0.9.89.
|
||||
@@ -3476,7 +3484,8 @@ Note: This release is considered a breaking change because installing on version
|
||||
|
||||
Initial release
|
||||
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v2.48.7...HEAD
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v2.48.8...HEAD
|
||||
[2.48.8]: https://github.com/taiki-e/install-action/compare/v2.48.7...v2.48.8
|
||||
[2.48.7]: https://github.com/taiki-e/install-action/compare/v2.48.6...v2.48.7
|
||||
[2.48.6]: https://github.com/taiki-e/install-action/compare/v2.48.5...v2.48.6
|
||||
[2.48.5]: https://github.com/taiki-e/install-action/compare/v2.48.4...v2.48.5
|
||||
|
||||
8
main.sh
8
main.sh
@@ -277,13 +277,13 @@ read_download_info() {
|
||||
bin_in_archive=()
|
||||
if [[ "${url}" == "null" ]]; then
|
||||
local template
|
||||
template=$(jq -r ".template.${host_platform}" "${manifest_dir}/${tool}.json")
|
||||
template=$(jq -c ".template.${host_platform}" "${manifest_dir}/${tool}.json")
|
||||
template="${template//\$\{version\}/${exact_version}}"
|
||||
url=$(jq -r '.url' <<<"${template}")
|
||||
url="${url//\$\{version\}/${exact_version}}"
|
||||
tmp=$(jq -r '.bin' <<<"${template}" | sed -E "s/\\$\\{version\\}/${exact_version}/g")
|
||||
tmp=$(jq -r '.bin' <<<"${template}")
|
||||
if [[ "${tmp}" == *"["* ]]; then
|
||||
# shellcheck disable=SC2207
|
||||
bin_in_archive=($(jq -r '.bin[]' <<<"${template}" | sed -E "s/\\$\\{version\\}/${exact_version}/g"))
|
||||
bin_in_archive=($(jq -r '.bin[]' <<<"${template}"))
|
||||
fi
|
||||
else
|
||||
tmp=$(jq -r '.bin' <<<"${download_info}")
|
||||
|
||||
36
manifests/cargo-hack.json
generated
36
manifests/cargo-hack.json
generated
@@ -3,10 +3,42 @@
|
||||
"template": null,
|
||||
"license_markdown": "[Apache-2.0](https://github.com/taiki-e/cargo-hack/blob/main/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/cargo-hack/blob/main/LICENSE-MIT)",
|
||||
"latest": {
|
||||
"version": "0.6.34"
|
||||
"version": "0.6.35"
|
||||
},
|
||||
"0.6": {
|
||||
"version": "0.6.34"
|
||||
"version": "0.6.35"
|
||||
},
|
||||
"0.6.35": {
|
||||
"x86_64_linux_musl": {
|
||||
"url": "https://github.com/taiki-e/cargo-hack/releases/download/v0.6.35/cargo-hack-x86_64-unknown-linux-musl.tar.gz",
|
||||
"etag": "0x8DD4A6E5EB58C77",
|
||||
"checksum": "eff70993a6da63125e378ff37b029e8ec3df738d8f52e100a003d0f1bb999a46"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"url": "https://github.com/taiki-e/cargo-hack/releases/download/v0.6.35/cargo-hack-x86_64-apple-darwin.tar.gz",
|
||||
"etag": "0x8DD4A6E7EFB6D18",
|
||||
"checksum": "04a5849fe5d8da9f41cb9a784c0a3f9a4c572db6dfcb2bd585da565cba51b5f2"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"url": "https://github.com/taiki-e/cargo-hack/releases/download/v0.6.35/cargo-hack-x86_64-pc-windows-msvc.tar.gz",
|
||||
"etag": "0x8DD4A6E6C197A37",
|
||||
"checksum": "bb00d151d1acd36f2c545941cbc1c84ad6efbd54dd5a284d1699b10c9175c97d"
|
||||
},
|
||||
"aarch64_linux_musl": {
|
||||
"url": "https://github.com/taiki-e/cargo-hack/releases/download/v0.6.35/cargo-hack-aarch64-unknown-linux-musl.tar.gz",
|
||||
"etag": "0x8DD4A6E34F0549E",
|
||||
"checksum": "917a14465547ca09b7e0872ca2532e877c5a2ed1f919bc52ff297d812ee34012"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"url": "https://github.com/taiki-e/cargo-hack/releases/download/v0.6.35/cargo-hack-aarch64-apple-darwin.tar.gz",
|
||||
"etag": "0x8DD4A6E44BEE1EA",
|
||||
"checksum": "4a147720e1ab3ef295af88d6c26781999b2c23bd6d40f9f7ddad7cf2e68441ed"
|
||||
},
|
||||
"aarch64_windows": {
|
||||
"url": "https://github.com/taiki-e/cargo-hack/releases/download/v0.6.35/cargo-hack-aarch64-pc-windows-msvc.tar.gz",
|
||||
"etag": "0x8DD4A6E338AB5BB",
|
||||
"checksum": "43e878cb91d845cbfc396e146d0e9eb174e7b28623dbf4f8b7d8039f120a6a45"
|
||||
}
|
||||
},
|
||||
"0.6.34": {
|
||||
"x86_64_linux_musl": {
|
||||
|
||||
30
manifests/cargo-minimal-versions.json
generated
30
manifests/cargo-minimal-versions.json
generated
@@ -22,10 +22,36 @@
|
||||
},
|
||||
"license_markdown": "[Apache-2.0](https://github.com/taiki-e/cargo-minimal-versions/blob/main/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/cargo-minimal-versions/blob/main/LICENSE-MIT)",
|
||||
"latest": {
|
||||
"version": "0.1.29"
|
||||
"version": "0.1.30"
|
||||
},
|
||||
"0.1": {
|
||||
"version": "0.1.29"
|
||||
"version": "0.1.30"
|
||||
},
|
||||
"0.1.30": {
|
||||
"x86_64_linux_musl": {
|
||||
"etag": "0x8DD4A6E25DB06C6",
|
||||
"checksum": "72a89985f39e12285b7d8e63cf26d8f41c97d72aea83478dc685d513d9e75044"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"etag": "0x8DD4A6E0A5AE6A1",
|
||||
"checksum": "3cacfaedc52499c4a2875148ede335c504e6dadd605a726baafc76929d6f7ddc"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"etag": "0x8DD4A6E000C0CDA",
|
||||
"checksum": "58516125269596aa451e524663f30e70fbacacf252bff6f35ca606abf1be43ec"
|
||||
},
|
||||
"aarch64_linux_musl": {
|
||||
"etag": "0x8DD4A6E044102DA",
|
||||
"checksum": "60371ed27eb44193774ada646fd58608fa6441b89913268880168795d9cd0a65"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"etag": "0x8DD4A6DDE1DB827",
|
||||
"checksum": "99c141466361587a6e9c5a0455245e1379ada63d7258b6a6765bc0f715a4444e"
|
||||
},
|
||||
"aarch64_windows": {
|
||||
"etag": "0x8DD4A6E17E7FE9E",
|
||||
"checksum": "3e226428d21c4db9dd9aaf34b8ea7046be87af3ef9b294b80ac14d8cb6a75845"
|
||||
}
|
||||
},
|
||||
"0.1.29": {
|
||||
"x86_64_linux_musl": {
|
||||
|
||||
30
manifests/cargo-no-dev-deps.json
generated
30
manifests/cargo-no-dev-deps.json
generated
@@ -22,10 +22,36 @@
|
||||
},
|
||||
"license_markdown": "[Apache-2.0](https://github.com/taiki-e/cargo-no-dev-deps/blob/main/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/cargo-no-dev-deps/blob/main/LICENSE-MIT)",
|
||||
"latest": {
|
||||
"version": "0.2.14"
|
||||
"version": "0.2.15"
|
||||
},
|
||||
"0.2": {
|
||||
"version": "0.2.14"
|
||||
"version": "0.2.15"
|
||||
},
|
||||
"0.2.15": {
|
||||
"x86_64_linux_musl": {
|
||||
"etag": "0x8DD4A6E15A58780",
|
||||
"checksum": "d917d43b52d04a643b8bca6492d2592eeb34d78d76aad26861e15247689f6d6a"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"etag": "0x8DD4A6E115D44AA",
|
||||
"checksum": "5f260e5bbc1c8ff760cd68d0a05ea953a3c69940fc1f766209a5310b7ddd910d"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"etag": "0x8DD4A6DFE0E5EA1",
|
||||
"checksum": "255d926f677c970a653528e10e159db9d35b70eb6b4363d14a012c39b890c2be"
|
||||
},
|
||||
"aarch64_linux_musl": {
|
||||
"etag": "0x8DD4A6E04BB2D14",
|
||||
"checksum": "05179148e3e2c84b1e808b52fcd30395a49df3347c932a2ae4dd34a3db5c6dcb"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"etag": "0x8DD4A6DE379D4E7",
|
||||
"checksum": "859e6f542b701b279641cc7616214e69c3b951195a4b9372f70a7e8b8a3ec1ac"
|
||||
},
|
||||
"aarch64_windows": {
|
||||
"etag": "0x8DD4A6E0CFFBCF1",
|
||||
"checksum": "44467a4d4b290edf18ec28dd2e6cb63c4b551cd6c7a96350205a3cd4ceb555b0"
|
||||
}
|
||||
},
|
||||
"0.2.14": {
|
||||
"x86_64_linux_musl": {
|
||||
|
||||
@@ -18,7 +18,7 @@ spdx = "0.10"
|
||||
tar = "0.4"
|
||||
toml_edit = { version = "0.22", default-features = false, features = ["parse", "serde"] }
|
||||
# TODO: call curl command instead of using ureq?
|
||||
ureq = { version = "3", features = ["json"] }
|
||||
ureq = { version = "2", features = ["json"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -19,7 +19,6 @@ use install_action_internal_codegen::{
|
||||
};
|
||||
use sha2::{Digest as _, Sha256};
|
||||
use spdx::expression::{ExprNode, ExpressionReq, Operator};
|
||||
use ureq::http::header;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args: Vec<_> = env::args().skip(1).collect();
|
||||
@@ -53,7 +52,7 @@ fn main() -> Result<()> {
|
||||
|
||||
eprintln!("downloading metadata from https://api.github.com/repos/{repo}");
|
||||
let repo_info: github::RepoMetadata =
|
||||
download(&format!("https://api.github.com/repos/{repo}"))?.body_mut().read_json()?;
|
||||
download(&format!("https://api.github.com/repos/{repo}"))?.into_json()?;
|
||||
|
||||
eprintln!("downloading releases from https://api.github.com/repos/{repo}/releases");
|
||||
let mut releases: github::Releases = vec![];
|
||||
@@ -64,8 +63,7 @@ fn main() -> Result<()> {
|
||||
let mut r: github::Releases = download(&format!(
|
||||
"https://api.github.com/repos/{repo}/releases?per_page={per_page}&page={page}"
|
||||
))?
|
||||
.body_mut()
|
||||
.read_json()?;
|
||||
.into_json()?;
|
||||
// If version_req is latest, it is usually sufficient to look at the latest 100 releases.
|
||||
if r.len() < per_page || version_req.is_some_and(|req| req == "latest") {
|
||||
releases.append(&mut r);
|
||||
@@ -100,13 +98,11 @@ fn main() -> Result<()> {
|
||||
if let Some(crate_name) = &base_info.rust_crate {
|
||||
eprintln!("downloading crate info from https://crates.io/api/v1/crates/{crate_name}");
|
||||
let info = download(&format!("https://crates.io/api/v1/crates/{crate_name}"))?
|
||||
.body_mut()
|
||||
.read_json::<crates_io::Crate>()?;
|
||||
.into_json::<crates_io::Crate>()?;
|
||||
let latest_version = &info.versions[0].num;
|
||||
crates_io_version_detail = Some(
|
||||
download(&format!("https://crates.io/api/v1/crates/{crate_name}/{latest_version}"))?
|
||||
.body_mut()
|
||||
.read_json::<crates_io::VersionMetadata>()?
|
||||
.into_json::<crates_io::VersionMetadata>()?
|
||||
.version,
|
||||
);
|
||||
|
||||
@@ -296,13 +292,8 @@ fn main() -> Result<()> {
|
||||
Path::new(&url).file_name().unwrap().to_str().unwrap()
|
||||
));
|
||||
let response = download(&url)?;
|
||||
let etag = response
|
||||
.headers()
|
||||
.get("etag")
|
||||
.expect("binary should have an etag")
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.replace('\"', "");
|
||||
let etag =
|
||||
response.header("etag").expect("binary should have an etag").replace('\"', "");
|
||||
|
||||
if let Some(ManifestRef::Real(ref manifest)) = existing_manifest {
|
||||
if let Some(entry) = manifest.download_info.get(&platform) {
|
||||
@@ -319,9 +310,9 @@ fn main() -> Result<()> {
|
||||
|
||||
if download_cache.is_file() {
|
||||
eprintln!("already downloaded");
|
||||
fs::File::open(download_cache)?.read_to_end(&mut buf)?;
|
||||
fs::File::open(download_cache)?.read_to_end(&mut buf)?; // Not buffered because it is read at once.
|
||||
} else {
|
||||
response.into_body().into_reader().read_to_end(&mut buf)?;
|
||||
response.into_reader().read_to_end(&mut buf)?;
|
||||
eprintln!("download complete");
|
||||
fs::write(download_cache, &buf)?;
|
||||
}
|
||||
@@ -344,7 +335,7 @@ fn main() -> Result<()> {
|
||||
eprintln!("already downloaded");
|
||||
minisign_verify::Signature::from_file(sig_download_cache)?
|
||||
} else {
|
||||
let buf = download(&url)?.body_mut().read_to_string()?;
|
||||
let buf = download(&url)?.into_string()?;
|
||||
eprintln!("download complete");
|
||||
fs::write(sig_download_cache, &buf)?;
|
||||
minisign_verify::Signature::decode(&buf)?
|
||||
@@ -362,7 +353,7 @@ fn main() -> Result<()> {
|
||||
if crate_download_cache.is_file() {
|
||||
eprintln!("already downloaded");
|
||||
} else {
|
||||
download(&url)?.into_body().into_reader().read_to_end(&mut buf2)?;
|
||||
download(&url)?.into_reader().read_to_end(&mut buf2)?;
|
||||
let hash = Sha256::digest(&buf2);
|
||||
if format!("{hash:x}") != v.checksum {
|
||||
bail!("checksum mismatch for {url}");
|
||||
@@ -454,6 +445,14 @@ fn main() -> Result<()> {
|
||||
// macOS universal binary or x86_64 binary that works on both x86_64 and AArch64 (rosetta).
|
||||
download_info.remove(&HostPlatform::aarch64_macos);
|
||||
}
|
||||
if download_info.contains_key(&HostPlatform::x86_64_windows)
|
||||
&& download_info.contains_key(&HostPlatform::aarch64_windows)
|
||||
&& download_info[&HostPlatform::x86_64_windows].url
|
||||
== download_info[&HostPlatform::aarch64_windows].url
|
||||
{
|
||||
// x86_64 Windows binary that works on both x86_64 and AArch64.
|
||||
download_info.remove(&HostPlatform::aarch64_windows);
|
||||
}
|
||||
has_build_metadata |= !semver_version.build.is_empty();
|
||||
if semver_version.pre.is_empty() {
|
||||
semver_versions.insert(semver_version.clone());
|
||||
@@ -691,7 +690,7 @@ static GITHUB_TOKENS: LazyLock<GitHubTokens> = LazyLock::new(|| {
|
||||
}
|
||||
});
|
||||
|
||||
fn download(url: &str) -> Result<ureq::http::Response<ureq::Body>> {
|
||||
fn download(url: &str) -> Result<ureq::Response> {
|
||||
let mut token = GITHUB_TOKENS.get(url);
|
||||
let mut retry = 0;
|
||||
let mut retry_time = 0;
|
||||
@@ -703,7 +702,7 @@ fn download(url: &str) -> Result<ureq::http::Response<ureq::Body>> {
|
||||
loop {
|
||||
let mut req = ureq::get(url);
|
||||
if let Some(token) = &token {
|
||||
req = req.header(header::AUTHORIZATION, &format!("Bearer {token}"));
|
||||
req = req.set("Authorization", &format!("Bearer {token}"));
|
||||
}
|
||||
match req.call() {
|
||||
Ok(res) => return Ok(res),
|
||||
@@ -739,12 +738,12 @@ fn github_head(url: &str) -> Result<()> {
|
||||
loop {
|
||||
let mut req = ureq::head(url);
|
||||
if let Some(token) = &token {
|
||||
req = req.header(header::AUTHORIZATION, &format!("Bearer {token}"));
|
||||
req = req.set("Authorization", &format!("Bearer {token}"));
|
||||
}
|
||||
match req.call() {
|
||||
Ok(_) => return Ok(()),
|
||||
// rate limit
|
||||
Err(e @ ureq::Error::StatusCode(403)) => last_error = Some(e),
|
||||
Err(e @ ureq::Error::Status(403, _)) => last_error = Some(e),
|
||||
Err(e) => return Err(e.into()),
|
||||
}
|
||||
retry_time += 1;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
|
||||
use std::{env, fmt, io::Write as _, path::PathBuf};
|
||||
use std::{
|
||||
env, fmt,
|
||||
io::{BufWriter, Write as _},
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
use anyhow::Result;
|
||||
use fs_err as fs;
|
||||
@@ -111,8 +115,7 @@ fn main() -> Result<()> {
|
||||
let mut markdown_file = workspace_root.clone();
|
||||
markdown_file.push("TOOLS.md");
|
||||
|
||||
let file = std::fs::File::create(markdown_file).expect("Unable to create file");
|
||||
let mut file = std::io::BufWriter::new(file);
|
||||
let mut file = BufWriter::new(fs::File::create(markdown_file).unwrap()); // Buffered because it is written many times.
|
||||
|
||||
file.write_all(HEADER.as_bytes()).expect("Unable to write header");
|
||||
|
||||
@@ -121,6 +124,7 @@ fn main() -> Result<()> {
|
||||
}
|
||||
|
||||
file.write_all(FOOTER.as_bytes()).expect("Unable to write footer");
|
||||
file.flush()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user