1
0
forked from Eeveid/lightOps

🐛 fix(workflow): 修复发布工作流的 Rust 初始化逻辑

- 在系统依赖阶段补充 rustc 和 cargo,减少对 rustup 在线安装的依赖
- 安装 Rust 前先加载 ~/.cargo/env 并补充 ~/.cargo/bin 到 PATH
- 仅在本机确实缺少 cargo 时才走 rustup 兜底,避免 runner 已装 rustup 但未生效时误触发联网更新
This commit is contained in:
2026-05-25 22:14:25 +08:00
parent 707f64bcb3
commit 121bd8bd7f

View File

@@ -39,21 +39,26 @@ jobs:
set -eux
if command -v apt-get >/dev/null 2>&1; then
apt-get update
apt-get install -y build-essential pkg-config sqlite3 curl tar ca-certificates nodejs npm
apt-get install -y build-essential pkg-config sqlite3 curl tar ca-certificates nodejs npm rustc cargo
elif command -v dnf >/dev/null 2>&1; then
dnf install -y gcc gcc-c++ make pkgconf-pkg-config sqlite curl tar ca-certificates nodejs npm
dnf install -y gcc gcc-c++ make pkgconf-pkg-config sqlite curl tar ca-certificates nodejs npm rust cargo
elif command -v yum >/dev/null 2>&1; then
yum install -y gcc gcc-c++ make pkgconfig sqlite curl tar ca-certificates nodejs npm
yum install -y gcc gcc-c++ make pkgconfig sqlite curl tar ca-certificates nodejs npm rust cargo
elif command -v pacman >/dev/null 2>&1; then
pacman -Sy --noconfirm base-devel pkgconf sqlite curl tar ca-certificates nodejs npm
pacman -Sy --noconfirm base-devel pkgconf sqlite curl tar ca-certificates nodejs npm rust cargo
fi
- name: 安装 Rust
run: |
set -eux
if [ -f "$HOME/.cargo/env" ]; then
. "$HOME/.cargo/env"
fi
export PATH="$HOME/.cargo/bin:$PATH"
if ! command -v cargo >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal
. "$HOME/.cargo/env"
export PATH="$HOME/.cargo/bin:$PATH"
fi
rustc -V
cargo -V