1
0
forked from Eeveid/lightOps

13 Commits

Author SHA1 Message Date
9ffe425d6e 🐛 fix(workflow): 修复 Cargo 镜像配置的 YAML 语法
- 去掉 run 脚本中的 heredoc 写法,避免 YAML 将 TOML 内容误判为工作流字段
- 改为使用 printf 生成 ~/.cargo/config.toml
- 保持 crates-io 切换到 rsproxy sparse registry 的逻辑不变
2026-05-26 20:38:47 +08:00
7e8d4baac6 🐛 fix(workflow): 为 Cargo 配置 crates 镜像源
- 在安装 Rust 步骤写入 ~/.cargo/config.toml,将 crates-io 切换到 rsproxy sparse registry
- 避免 runner 访问 index.crates.io 超时导致依赖下载失败
- 与 rustup 镜像配置配合,统一走国内镜像完成工具链和依赖安装
2026-05-26 20:34:23 +08:00
a79ef99500 🐛 fix(workflow): 为 rustup 配置镜像下载源
- 在安装 Rust 和构建步骤中设置 RUSTUP_DIST_SERVER 与 RUSTUP_UPDATE_ROOT
- 避免 runner 直连 static.rust-lang.org 超时导致 stable 工具链安装失败
- 保持通过 rustup stable 获取新版 cargo 以兼容 Cargo.lock v4
2026-05-26 20:20:25 +08:00
f1491ba114 🐛 fix(workflow): 固定使用新版 Rust stable 工具链
- 发布工作流不再依赖 runner 自带 rustc/cargo 版本
- 改为通过 rustup 安装并默认切换到 stable 工具链,兼容 Cargo.lock v4
- 构建步骤统一加载 ~/.cargo/env,避免旧版系统 cargo 抢占路径
2026-05-26 19:54:18 +08:00
8db385cca6 fix: 修改运行环境 2026-05-26 19:39:31 +08:00
738ff8248f 🐛 fix(release): 显式传递发布目标仓库参数
- 发布步骤调用 publish-gitea-release.sh 时显式传入 gitea-url、owner 和 repo
- 避免子进程回退到脚本默认值 Eeveid/lightOps,导致日志和 Release 目标仓库混淆
- 保持当前使用 RELEASE_TOKEN 和 main 作为 target_commitish 的逻辑不变
2026-05-26 18:25:09 +08:00
acc89faa8b 🐛 fix(release): 用默认分支替代提交 SHA 创建 Release
- 发布步骤不再将 git rev-parse HEAD 的完整提交 SHA 作为 target_commitish
- 改为显式使用 main,匹配当前 Gitea 实例对 Release 创建接口的可接受参数
- 清理前面为定位 token 问题加入的临时 probe 调试逻辑
2026-05-26 15:22:51 +08:00
13e4d1f684 🔧 chore(workflow): 增强调试 Release Token 校验
- 输出当前 RELEASE_TOKEN 的 sha256 摘要,便于与本地成功 token 做无泄露比对
- 在发布前直接用当前 token 探测创建 Release API 并打印响应体
- 为定位 workflow 内 token 与手工 curl 结果不一致的问题提供确定性证据
2026-05-26 15:00:12 +08:00
975b7b170c 🔧 chore(workflow): 打印 Release Token 调试信息
- 在发布步骤中直接输出 RELEASE_TOKEN 明文以确认仓库密钥实际注入值
- 同时打印 GITEA/GITHUB/RELEASE 相关环境变量便于比对
- 仅用于当前排障,后续验证完成后应移除
2026-05-26 14:01:59 +08:00
c47791bc3c 🔧 chore(workflow): 移除 Release Token 预检日志
- 清理发布步骤中的临时调试输出
- 保持使用 RELEASE_TOKEN 进行 Release 发布
- 为重新验证更新后的仓库密钥提供干净日志
2026-05-26 13:34:55 +08:00
70f80355da 🔧 chore(workflow): 增加 Release Token 预检日志
- 在发布步骤前输出 RELEASE_TOKEN 长度,避免空值或旧值问题继续被误判
- 使用当前 token 预检 /api/v1/user 和 releases 列表接口状态码
- 为后续定位 workflow 与本地手工调用结果不一致的问题提供直接证据
2026-05-26 13:16:40 +08:00
abcfcf7b33 🐛 fix(release): 改用 RELEASE_TOKEN 发布版本
- 工作流发布步骤改为显式使用仓库密钥 RELEASE_TOKEN
- 去掉发布脚本对 404 的吞错处理,改回明确暴露真实权限或接口错误
- 便于验证当前自定义 token 是否具备 Gitea Release 创建与附件上传权限
2026-05-26 12:46:24 +08:00
aad3db8315 🐛 fix(workflow): 回退发布任务到 runner_admin
- 将 release 工作流的 runs-on 从 ubuntu-latest 调回 runner_admin
- 避免当前 act runner 在 Set up job 阶段卡住,优先验证发布链本身
- 保留前面已经修复的动态检出、Rust 构建和 Release 兼容逻辑
2026-05-26 11:56:40 +08:00
2 changed files with 28 additions and 53 deletions

View File

@@ -48,40 +48,27 @@ 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 rustc cargo
apt-get install -y build-essential pkg-config sqlite3 curl tar ca-certificates nodejs npm
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 rust cargo
dnf install -y gcc gcc-c++ make pkgconf-pkg-config sqlite curl tar ca-certificates nodejs npm
elif command -v yum >/dev/null 2>&1; then
yum install -y gcc gcc-c++ make pkgconfig sqlite curl tar ca-certificates nodejs npm rust cargo
yum install -y gcc gcc-c++ make pkgconfig sqlite curl tar ca-certificates nodejs npm
elif command -v pacman >/dev/null 2>&1; then
pacman -Sy --noconfirm base-devel pkgconf sqlite curl tar ca-certificates nodejs npm rust cargo
pacman -Sy --noconfirm base-devel pkgconf sqlite curl tar ca-certificates nodejs npm
fi
- name: 安装 Rust
env:
RUSTUP_DIST_SERVER: https://rsproxy.cn
RUSTUP_UPDATE_ROOT: https://rsproxy.cn/rustup
run: |
set -eux
PATH_BASE="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
PATH_EXTRA=""
OLD_IFS="$IFS"
IFS=':'
set -- $PATH
IFS="$OLD_IFS"
for entry in "$@"; do
[ -n "$entry" ] || continue
[ "$entry" = "$HOME/.cargo/bin" ] && continue
case ":$PATH_BASE:$PATH_EXTRA:" in
*":$entry:"*) continue ;;
esac
PATH_EXTRA="${PATH_EXTRA:+$PATH_EXTRA:}$entry"
done
export PATH="$PATH_BASE${PATH_EXTRA:+:$PATH_EXTRA}"
if ! command -v cargo >/dev/null 2>&1 || ! command -v rustc >/dev/null 2>&1; then
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
fi
if ! command -v cargo >/dev/null 2>&1 || ! command -v rustc >/dev/null 2>&1; then
if ! command -v rustup >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal
. "$HOME/.cargo/env"
fi
. "$HOME/.cargo/env"
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
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
@@ -93,28 +80,22 @@ jobs:
echo "使用 Rust 构建目标: $BUILD_TARGET"
rustc -V
cargo -V
mkdir -p "$HOME/.cargo"
printf '%s\n' \
'[source.crates-io]' \
'replace-with = "rsproxy-sparse"' \
'' \
'[source.rsproxy-sparse]' \
'registry = "sparse+https://rsproxy.cn/index/"' \
>"$HOME/.cargo/config.toml"
- name: 构建发布包
env:
RUSTUP_DIST_SERVER: https://rsproxy.cn
RUSTUP_UPDATE_ROOT: https://rsproxy.cn/rustup
run: |
set -eux
PATH_BASE="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
PATH_EXTRA=""
OLD_IFS="$IFS"
IFS=':'
set -- $PATH
IFS="$OLD_IFS"
for entry in "$@"; do
[ -n "$entry" ] || continue
[ "$entry" = "$HOME/.cargo/bin" ] && continue
case ":$PATH_BASE:$PATH_EXTRA:" in
*":$entry:"*) continue ;;
esac
PATH_EXTRA="${PATH_EXTRA:+$PATH_EXTRA:}$entry"
done
export PATH="$PATH_BASE${PATH_EXTRA:+:$PATH_EXTRA}"
if ! command -v cargo >/dev/null 2>&1 || ! command -v rustc >/dev/null 2>&1; then
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
fi
. "$HOME/.cargo/env"
cd lightops-src
TAG="$(cat /tmp/lightops-release-tag)"
VERSION="${TAG#v}"
@@ -127,7 +108,7 @@ jobs:
- name: 发布到 Gitea Release
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
set -eux
SERVER_URL="${GITHUB_SERVER_URL:-${GITEA_SERVER_URL:-https://gitea.kmux.cn}}"
@@ -137,11 +118,13 @@ jobs:
GITEA_REPO="${REPOSITORY#*/}"
cd lightops-src
TAG="$(cat /tmp/lightops-release-tag)"
TARGET_SHA="$(git rev-parse HEAD)"
bash scripts/publish-gitea-release.sh \
--gitea-url "$GITEA_URL" \
--owner "$GITEA_OWNER" \
--repo "$GITEA_REPO" \
--tag "$TAG" \
--title "LightOps ${TAG}" \
--target "$TARGET_SHA" \
--target "main" \
--no-create-tag \
--no-push-tag \
--package target/releases/*.tar.gz \

View File

@@ -213,14 +213,6 @@ else
create_result="$(api_post_json_with_status "$(api_url releases)" "$payload")" || fail "创建 Release 请求失败"
create_status="${create_result##*$'\n'}"
release_json="${create_result%$'\n'*}"
if [[ "$create_status" == "404" ]]; then
log "当前仓库不支持 Releases 或 Token 无 Release 权限,跳过发布"
printf '\n发布包已生成但未上传 Release\n'
for package in "${PACKAGES[@]}"; do
printf '%s\n' "$package"
done
exit 0
fi
[[ "$create_status" == "201" || "$create_status" == "200" ]] || fail "创建 Release 失败HTTP 状态码:$create_status"
fi