From 121bd8bd7fd51c2a317cff8d622d56d1deca135d Mon Sep 17 00:00:00 2001 From: zhilv Date: Mon, 25 May 2026 22:14:25 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(workflow):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=8F=91=E5=B8=83=E5=B7=A5=E4=BD=9C=E6=B5=81=E7=9A=84?= =?UTF-8?q?=20Rust=20=E5=88=9D=E5=A7=8B=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在系统依赖阶段补充 rustc 和 cargo,减少对 rustup 在线安装的依赖 - 安装 Rust 前先加载 ~/.cargo/env 并补充 ~/.cargo/bin 到 PATH - 仅在本机确实缺少 cargo 时才走 rustup 兜底,避免 runner 已装 rustup 但未生效时误触发联网更新 --- .gitea/workflows/release.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index d4edf24..fb0c6c3 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -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