mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
Merge branch 'beta'
This commit is contained in:
commit
e7e0b50f87
103 files changed
+9143
-6826
No files matched your search
@@ -2,10 +2,13 @@ name: Build & Package Module
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
branches: [main, beta, dev]
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -29,45 +32,77 @@ jobs:
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build WebUI
|
||||
run: pnpm build
|
||||
run: pnpm build:webui
|
||||
|
||||
# ── 2. lumipro 二进制 ────────────────────────────────────────────────
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
# ── 2. luminpro 二进制 (Go) ─────────────────────────────────────────
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
targets: aarch64-linux-android
|
||||
go-version-file: go/go.mod
|
||||
cache-dependency-path: go/go.sum
|
||||
|
||||
- name: Setup Android NDK
|
||||
uses: nttld/setup-ndk@v1
|
||||
id: ndk
|
||||
with:
|
||||
ndk-version: r27c
|
||||
|
||||
- name: Cache Rust dependencies
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: rust
|
||||
|
||||
- name: Install cargo-ndk
|
||||
run: cargo install cargo-ndk --locked
|
||||
|
||||
- name: Build lumipro (aarch64-linux-android)
|
||||
working-directory: rust
|
||||
env:
|
||||
ANDROID_NDK_HOME: ${{ steps.ndk.outputs.ndk-path }}
|
||||
run: cargo ndk -t arm64-v8a --platform 26 build --release
|
||||
|
||||
- name: Copy binary to bin/
|
||||
- name: Test Go packages
|
||||
working-directory: go
|
||||
run: |
|
||||
cp rust/target/aarch64-linux-android/release/lumipro bin/lumipro
|
||||
chmod +x bin/lumipro
|
||||
go vet ./...
|
||||
go test ./...
|
||||
|
||||
# ── 3. 打包模块 ──────────────────────────────────────────────────────
|
||||
- name: Build luminpro (android/arm64)
|
||||
working-directory: go
|
||||
run: |
|
||||
mkdir -p ../bin
|
||||
CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o ../bin/luminpro ./cmd/luminpro
|
||||
chmod +x ../bin/luminpro
|
||||
|
||||
# ── 3. 判定发布通道 ─────────────────────────────────────────────────
|
||||
# tag 含 -beta → beta 通道(prerelease);其余 tag → stable;
|
||||
# 分支构建:dev → dev、beta → beta、main → stable(仅出 artifact)
|
||||
- name: Resolve release channel
|
||||
id: channel
|
||||
run: |
|
||||
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
|
||||
TAG="${GITHUB_REF_NAME}"
|
||||
if [[ "$TAG" == *-beta* ]]; then
|
||||
echo "channel=beta" >> "$GITHUB_OUTPUT"
|
||||
echo "prerelease=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "channel=stable" >> "$GITHUB_OUTPUT"
|
||||
echo "prerelease=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
else
|
||||
case "${GITHUB_REF_NAME}" in
|
||||
dev) echo "channel=dev" >> "$GITHUB_OUTPUT" ;;
|
||||
beta) echo "channel=beta" >> "$GITHUB_OUTPUT" ;;
|
||||
*) echo "channel=stable" >> "$GITHUB_OUTPUT" ;;
|
||||
esac
|
||||
echo "prerelease=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
# ── 4. 打包模块 ─────────────────────────────────────────────────────
|
||||
- name: Package module
|
||||
run: node build-module.js
|
||||
run: node build-module.js --channel=${{ steps.channel.outputs.channel }}
|
||||
|
||||
# ── 4. 重命名 zip 加入 commit 短哈希 ─────────────────────────────────
|
||||
- name: Rename zip with commit hash
|
||||
# ── 5a. tag 构建:创建 GitHub Release 并上传资产 ─────────────────────
|
||||
# Release 资产文件名必须与更新清单里的 zipUrl 完全一致
|
||||
- name: Publish release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION=$(grep '^version=' module.prop | cut -d= -f2 | tr -d '[:space:]')
|
||||
ZIP="LuminPro_${VERSION}.zip"
|
||||
NOTES=$(awk '/^## / { if (p) exit; p=1; next } p { print }' changelog.md)
|
||||
[ -n "$NOTES" ] || NOTES="自动构建产物"
|
||||
FLAGS=""
|
||||
if [ "${{ steps.channel.outputs.prerelease }}" = "true" ]; then FLAGS="--prerelease"; fi
|
||||
gh release create "${GITHUB_REF_NAME}" "$ZIP" \
|
||||
--title "${GITHUB_REF_NAME}" \
|
||||
--notes "$NOTES" \
|
||||
$FLAGS
|
||||
|
||||
# ── 5b. 分支构建:重命名后作为 artifact 上传 ────────────────────────
|
||||
- name: Rename artifact with commit hash
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
id: names
|
||||
run: |
|
||||
VERSION=$(grep '^version=' module.prop | cut -d= -f2 | tr -d '[:space:]')
|
||||
@@ -76,10 +111,8 @@ jobs:
|
||||
mv "LuminPro_${VERSION}.zip" "$FINAL"
|
||||
echo "zip=$FINAL" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# ── 5. 上传 artifact(单个 zip 文件) ────────────────────────────────
|
||||
# upload-artifact 上传单个文件时仍会套一层 zip;通过 gh run download 下载
|
||||
# 后得到的即是模块 zip,直接可刷入,无需二次解压。
|
||||
- name: Upload module zip
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.names.outputs.zip }}
|
||||
|
||||
Reference in new issue
Block a user