fix: 修复 Gitea 发布工作流在 fork/镜像仓库中的兼容性问题 #1

Merged
Eeveid merged 24 commits from zhilv/lightOps:main into main 2026-05-28 18:53:16 +08:00
Showing only changes of commit 4322023820 - Show all commits

View File

@@ -82,9 +82,15 @@ jobs:
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal
. "$HOME/.cargo/env"
fi
if command -v rustup >/dev/null 2>&1; then
rustup target list --installed | grep -qx 'x86_64-unknown-linux-gnu' || rustup target add x86_64-unknown-linux-gnu
HOST_TARGET="$(rustc -vV | sed -n 's/^host: //p')"
BUILD_TARGET="$HOST_TARGET"
if [ "$HOST_TARGET" != "x86_64-unknown-linux-gnu" ] && command -v rustup >/dev/null 2>&1; then
if rustup target list --installed | grep -qx 'x86_64-unknown-linux-gnu'; then
BUILD_TARGET="x86_64-unknown-linux-gnu"
fi
fi
printf '%s' "$BUILD_TARGET" > /tmp/lightops-build-target
echo "使用 Rust 构建目标: $BUILD_TARGET"
rustc -V
cargo -V
@@ -112,7 +118,12 @@ jobs:
cd lightops-src
TAG="$(cat /tmp/lightops-release-tag)"
VERSION="${TAG#v}"
bash scripts/build-release.sh --version "$VERSION" --target x86_64-unknown-linux-gnu
BUILD_TARGET="$(cat /tmp/lightops-build-target 2>/dev/null || true)"
if [ -z "$BUILD_TARGET" ]; then
BUILD_TARGET="$(rustc -vV | sed -n 's/^host: //p')"
fi
echo "构建发布目标: $BUILD_TARGET"
bash scripts/build-release.sh --version "$VERSION" --target "$BUILD_TARGET"
- name: 发布到 Gitea Release
env: