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 f839ea2266 - Show all commits

View File

@@ -60,14 +60,17 @@ jobs:
- name: 安装 Rust
run: |
set -eux
if [ -f "$HOME/.cargo/env" ]; then
. "$HOME/.cargo/env"
PATH_WITHOUT_CARGO_BIN="$(printf '%s' "$PATH" | awk -v RS=: -v ORS=: '$0 != ENVIRON["HOME"] \"/.cargo/bin\" { print }' | sed 's/:$//')"
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${PATH_WITHOUT_CARGO_BIN:+:$PATH_WITHOUT_CARGO_BIN}"
if ! command -v cargo >/dev/null 2>&1 || ! command -v rustc >/dev/null 2>&1; then
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
fi
export PATH="$HOME/.cargo/bin:$PATH"
if ! command -v cargo >/dev/null 2>&1; then
if ! command -v cargo >/dev/null 2>&1 || ! command -v rustc >/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
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
fi
rustc -V
cargo -V
@@ -75,7 +78,11 @@ jobs:
- name: 构建发布包
run: |
set -eux
. "$HOME/.cargo/env" 2>/dev/null || true
PATH_WITHOUT_CARGO_BIN="$(printf '%s' "$PATH" | awk -v RS=: -v ORS=: '$0 != ENVIRON["HOME"] \"/.cargo/bin\" { print }' | sed 's/:$//')"
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${PATH_WITHOUT_CARGO_BIN:+:$PATH_WITHOUT_CARGO_BIN}"
if ! command -v cargo >/dev/null 2>&1 || ! command -v rustc >/dev/null 2>&1; then
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
fi
cd lightops-src
TAG="$(cat /tmp/lightops-release-tag)"
VERSION="${TAG#v}"