2 Commits

Author SHA1 Message Date
a97ec39a1c 兼容更多 Runner 基础镜像
Some checks failed
发布 Linux 二进制 / release-linux-x86_64 (push) Failing after 1h58m58s
2026-05-25 15:06:13 +08:00
707f64bcb3 增强 Gitea 发布流程检出逻辑
Some checks failed
发布 Linux 二进制 / release-linux-x86_64 (push) Has been cancelled
2026-05-25 15:00:56 +08:00

View File

@@ -10,12 +10,28 @@ jobs:
runs-on: runner_admin runs-on: runner_admin
steps: steps:
- name: 检出代码 - name: 检出代码
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: | run: |
set -eux set -eux
TAG="${GITHUB_REF_NAME:-${GITEA_REF_NAME:-}}"
if [ -z "$TAG" ] && [ -n "${GITHUB_REF:-}" ]; then
TAG="${GITHUB_REF##*/}"
fi
if [ -z "$TAG" ]; then
echo "无法识别触发标签"
env | sort
exit 1
fi
printf '%s' "$TAG" > /tmp/lightops-release-tag
rm -rf lightops-src rm -rf lightops-src
git clone https://gitea.kmux.cn/Eeveid/lightOps.git lightops-src if [ -n "${GITEA_TOKEN:-}" ]; then
git clone "https://oauth2:${GITEA_TOKEN}@gitea.kmux.cn/Eeveid/lightOps.git" lightops-src
else
git clone https://gitea.kmux.cn/Eeveid/lightOps.git lightops-src
fi
cd lightops-src cd lightops-src
TAG="${GITHUB_REF_NAME:-${GITEA_REF_NAME:-${GITHUB_REF##*/}}}" git fetch --tags --force
git checkout "$TAG" git checkout "$TAG"
- name: 安装系统依赖 - name: 安装系统依赖
@@ -24,19 +40,39 @@ jobs:
if command -v apt-get >/dev/null 2>&1; then if command -v apt-get >/dev/null 2>&1; then
apt-get update 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
elif command -v apk >/dev/null 2>&1; then
apk add --no-cache build-base pkgconf sqlite curl wget tar ca-certificates nodejs npm bash git
elif command -v dnf >/dev/null 2>&1; then 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
elif command -v yum >/dev/null 2>&1; then 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
elif command -v pacman >/dev/null 2>&1; then 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
else
echo "未找到支持的包管理器,当前系统信息:"
uname -a || true
cat /etc/os-release || true
echo "PATH=$PATH"
exit 1
fi fi
command -v git
command -v tar
command -v node
command -v npm
command -v curl || command -v wget
- name: 安装 Rust - name: 安装 Rust
run: | run: |
set -eux set -eux
if ! command -v cargo >/dev/null 2>&1; then if ! command -v cargo >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal if command -v curl >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal
elif command -v wget >/dev/null 2>&1; then
wget -qO- https://sh.rustup.rs | sh -s -- -y --profile minimal
else
echo "缺少 curl/wget无法安装 Rust"
exit 1
fi
. "$HOME/.cargo/env" . "$HOME/.cargo/env"
fi fi
rustc -V rustc -V
@@ -47,7 +83,7 @@ jobs:
set -eux set -eux
. "$HOME/.cargo/env" 2>/dev/null || true . "$HOME/.cargo/env" 2>/dev/null || true
cd lightops-src cd lightops-src
TAG="${GITHUB_REF_NAME:-${GITEA_REF_NAME:-${GITHUB_REF##*/}}}" TAG="$(cat /tmp/lightops-release-tag)"
VERSION="${TAG#v}" VERSION="${TAG#v}"
bash scripts/build-release.sh --version "$VERSION" --target x86_64-unknown-linux-gnu bash scripts/build-release.sh --version "$VERSION" --target x86_64-unknown-linux-gnu
@@ -60,11 +96,12 @@ jobs:
run: | run: |
set -eux set -eux
cd lightops-src cd lightops-src
TAG="${GITHUB_REF_NAME:-${GITEA_REF_NAME:-${GITHUB_REF##*/}}}" TAG="$(cat /tmp/lightops-release-tag)"
TARGET_SHA="$(git rev-parse HEAD)"
bash scripts/publish-gitea-release.sh \ bash scripts/publish-gitea-release.sh \
--tag "$TAG" \ --tag "$TAG" \
--title "LightOps ${TAG}" \ --title "LightOps ${TAG}" \
--target "$GITHUB_SHA" \ --target "$TARGET_SHA" \
--no-create-tag \ --no-create-tag \
--no-push-tag \ --no-push-tag \
--package target/releases/*.tar.gz \ --package target/releases/*.tar.gz \