From 55a981690b2670493d925900a2569e5065371d31 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 5 Apr 2026 17:16:30 +0900 Subject: [PATCH] Support cargo-deb --- CHANGELOG.md | 2 ++ TOOLS.md | 1 + main.sh | 17 ++++++++++++++ manifests/cargo-deb.json | 37 +++++++++++++++++++++++++++++++ tools/ci/tool-list.sh | 4 ++++ tools/codegen/base/cargo-deb.json | 12 ++++++++++ 6 files changed, 73 insertions(+) create mode 100644 manifests/cargo-deb.json create mode 100644 tools/codegen/base/cargo-deb.json diff --git a/CHANGELOG.md b/CHANGELOG.md index a2e98975..eaaf9592 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] +- Support `cargo-deb`. ([#1669](https://github.com/taiki-e/install-action/pull/1669)) + ## [2.73.0] - 2026-04-05 - Introduce [dependency cooldown](https://blog.yossarian.net/2025/11/21/We-should-all-be-using-dependency-cooldowns) when installing with `taiki-e/install-action@`, `tool: @latest`, or `tool: @` to mitigate the risk of supply chain attacks by default. ([#1666](https://github.com/taiki-e/install-action/pull/1666)) diff --git a/TOOLS.md b/TOOLS.md index 4a324f1a..f106b8c2 100644 --- a/TOOLS.md +++ b/TOOLS.md @@ -22,6 +22,7 @@ See the [Supported tools section in README.md](README.md#supported-tools) for ho | [**cargo-careful**](https://github.com/RalfJung/cargo-careful) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/RalfJung/cargo-careful/releases) | Linux, macOS, Windows | [MIT](https://github.com/RalfJung/cargo-careful/blob/master/LICENSE-MIT) OR [Apache-2.0](https://github.com/RalfJung/cargo-careful/blob/master/LICENSE-APACHE) | | [**cargo-cyclonedx**](https://github.com/CycloneDX/cyclonedx-rust-cargo) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/CycloneDX/cyclonedx-rust-cargo/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/CycloneDX/cyclonedx-rust-cargo/blob/main/LICENSE) | | [**cargo-deadlinks**](https://github.com/deadlinks/cargo-deadlinks) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/deadlinks/cargo-deadlinks/releases) | Linux, macOS, Windows | [MIT](https://github.com/deadlinks/cargo-deadlinks/blob/master/LICENSE-MIT) OR [Apache-2.0](https://github.com/deadlinks/cargo-deadlinks/blob/master/LICENSE-APACHE) | +| [**cargo-deb**](https://github.com/kornelski/cargo-deb) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/kornelski/cargo-deb/releases) | Linux | [MIT](https://github.com/kornelski/cargo-deb/blob/main/LICENSE) | | [**cargo-deny**](https://github.com/EmbarkStudios/cargo-deny) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/EmbarkStudios/cargo-deny/releases) | Linux, macOS, Windows | [MIT](https://github.com/EmbarkStudios/cargo-deny/blob/main/LICENSE-MIT) OR [Apache-2.0](https://github.com/EmbarkStudios/cargo-deny/blob/main/LICENSE-APACHE) | | [**cargo-dinghy**](https://github.com/sonos/dinghy) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/sonos/dinghy/releases) | Linux, macOS | [MIT](https://github.com/sonos/dinghy/blob/main/LICENSE-MIT) OR [Apache-2.0](https://github.com/sonos/dinghy/blob/main/LICENSE-APACHE) | | [**cargo-export**](https://github.com/bazhenov/cargo-export) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/bazhenov/cargo-export/releases) | Linux, macOS, Windows | [MIT](https://github.com/bazhenov/cargo-export/blob/master/LICENSE) | diff --git a/main.sh b/main.sh index c44e4a70..968e3dd0 100755 --- a/main.sh +++ b/main.sh @@ -161,6 +161,17 @@ download_and_extract() { esac fi ;; + *.deb) + if ! type -P dpkg-deb >/dev/null; then + case "${base_distro}" in + debian | fedora | suse | arch | alpine) + printf '::group::Install packages required for installation (dpkg)\n' + sys_install dpkg + printf '::endgroup::\n' + ;; + esac + fi + ;; esac mkdir -p -- "${tmp_dir}" @@ -194,6 +205,12 @@ download_and_extract() { mv -- "${tmp}" "${bin_dir}/" done ;; + *.deb) + dpkg-deb -x tmp . + for tmp in "${bin_in_archive[@]}"; do + mv -- "${tmp}" "${bin_dir}/" + done + ;; *) for tmp in "${installed_bin[@]}"; do mv -- tmp "${tmp}" diff --git a/manifests/cargo-deb.json b/manifests/cargo-deb.json new file mode 100644 index 00000000..338bcf1a --- /dev/null +++ b/manifests/cargo-deb.json @@ -0,0 +1,37 @@ +{ + "rust_crate": "cargo-deb", + "template": { + "x86_64_linux_gnu": { + "url": "https://github.com/kornelski/cargo-deb/releases/download/v${version}/cargo-deb_${version}-1_amd64.deb", + "bin": "usr/bin/cargo-deb" + } + }, + "license_markdown": "[MIT](https://github.com/kornelski/cargo-deb/blob/main/LICENSE)", + "latest": { + "version": "3.6.3" + }, + "3": { + "version": "3.6.3" + }, + "3.6": { + "version": "3.6.3" + }, + "3.6.3": { + "x86_64_linux_gnu": { + "etag": "0x8DE63F58EBB06E1", + "hash": "e4b8c1a499a8f4e5b96d72f0d1ec9da8005ba379aee95aaeef83860991c831c3" + } + }, + "3.6.2": { + "x86_64_linux_gnu": { + "etag": "0x8DE0A5D04840934", + "hash": "a0053e0089f0efb194013e9629087c247d1de6cb439b7381b4109e21153b991e" + } + }, + "3.6.1": { + "x86_64_linux_gnu": { + "etag": "0x8DDE4DDD98766C4", + "hash": "c7c890cc90dae8c4f5f9ad0ff3d7675fec74fbb57ff89c4f27cfbbab34676e93" + } + } +} diff --git a/tools/ci/tool-list.sh b/tools/ci/tool-list.sh index 239e3779..12a35f74 100755 --- a/tools/ci/tool-list.sh +++ b/tools/ci/tool-list.sh @@ -8,6 +8,7 @@ cd -- "$(dirname -- "$0")"/../.. # They don't provide prebuilt binaries for musl or old glibc host. # version `GLIBC_2.35' not found glibc_pre_2_39_incompat=( + cargo-deb zizmor ) glibc_pre_2_35_incompat=( @@ -116,6 +117,9 @@ case "$(uname -s)" in if [[ "${runner}" == "ubuntu:14.04" ]]; then incompat_tools+=(cyclonedx) fi + if [[ "${runner}" == "almalinux:10"* ]]; then + incompat_tools+=(cargo-deb) # no dpkg in package manager + fi ;; Darwin) host_os=macos ;; MINGW* | MSYS* | CYGWIN* | Windows_NT) host_os=windows ;; diff --git a/tools/codegen/base/cargo-deb.json b/tools/codegen/base/cargo-deb.json new file mode 100644 index 00000000..476ca42c --- /dev/null +++ b/tools/codegen/base/cargo-deb.json @@ -0,0 +1,12 @@ +{ + "repository": "https://github.com/kornelski/cargo-deb", + "license_markdown": "[MIT](https://github.com/kornelski/cargo-deb/blob/main/LICENSE)", + "tag_prefix": "v", + "rust_crate": "${package}", + "platform": { + "x86_64_linux_gnu": { + "asset_name": "${package}_${version}-1_amd64.deb", + "bin": "usr/bin/${package}" + } + } +}