feat(release): 引入 dev/beta/stable 三通道发布规范

- build-module.js: --channel=dev|beta|stable(默认 dev)
  · 按通道生成包内 module.prop(name 加通道后缀、updateJson 指向对应分支清单)
  · stable/beta 写入对应更新清单,zipUrl 改为 GitHub Release 资产地址
  · dev 包不带 updateJson,不参与自动更新
- CI: dev/beta/main 分支与 v* tag 触发;tag 构建自动建 Release
  (beta 标记 prerelease),分支构建出带短哈希的 artifact
- 版本号规范 versionCode = 基础号×100 + 段位(正式 00 / beta 51-99 / dev 01-49)
- update.json 迁移到 GitHub 资产地址;WebUI 头部显示 Beta/Dev 通道徽标
- package.json 拆出 build:webui,避免 CI 首次打包污染清单
- SHA256SUMS 停止跟踪(每次构建重新生成)
- DEVELOPMENT.md 补充通道/版本号/发布流程,README 补充版本通道说明
This commit is contained in:
YuleBest committed 2026-09-10 04:58:21 +08:00
1 parent e50cf5bd89
commit 46b3b952e0
10 files changed
+215 -42

No files matched your search

+54 -10
View File
@@ -2,10 +2,13 @@ name: Build & Package Module
on: on:
push: push:
branches: [main] branches: [main, beta, dev]
tags: ['v*'] tags: ['v*']
workflow_dispatch: workflow_dispatch:
permissions:
contents: write
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -29,7 +32,7 @@ jobs:
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
- name: Build WebUI - name: Build WebUI
run: pnpm build run: pnpm build:webui
# ── 2. luminpro 二进制 (Go) ───────────────────────────────────────── # ── 2. luminpro 二进制 (Go) ─────────────────────────────────────────
- name: Setup Go - name: Setup Go
@@ -51,12 +54,55 @@ jobs:
CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o ../bin/luminpro ./cmd/luminpro CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o ../bin/luminpro ./cmd/luminpro
chmod +x ../bin/luminpro chmod +x ../bin/luminpro
# ── 3. 打包模块 ────────────────────────────────────────────────────── # ── 3. 判定发布通道 ─────────────────────────────────────────────────
- name: Package module # tag 含 -beta → beta 通道(prerelease);其余 tag → stable;
run: node build-module.js # 分支构建: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. 重命名 zip 加入 commit 短哈希 ───────────────────────────────── # ── 4. 打包模块 ─────────────────────────────────────────────────────
- name: Rename zip with commit hash - name: Package module
run: node build-module.js --channel=${{ steps.channel.outputs.channel }}
# ── 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 id: names
run: | run: |
VERSION=$(grep '^version=' module.prop | cut -d= -f2 | tr -d '[:space:]') VERSION=$(grep '^version=' module.prop | cut -d= -f2 | tr -d '[:space:]')
@@ -65,10 +111,8 @@ jobs:
mv "LuminPro_${VERSION}.zip" "$FINAL" mv "LuminPro_${VERSION}.zip" "$FINAL"
echo "zip=$FINAL" >> "$GITHUB_OUTPUT" echo "zip=$FINAL" >> "$GITHUB_OUTPUT"
# ── 5. 上传 artifact(单个 zip 文件) ────────────────────────────────
# upload-artifact 上传单个文件时仍会套一层 zip;通过 gh run download 下载
# 后得到的即是模块 zip,直接可刷入,无需二次解压。
- name: Upload module zip - name: Upload module zip
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ steps.names.outputs.zip }} name: ${{ steps.names.outputs.zip }}
+3
View File
@@ -18,3 +18,6 @@ deploy.js
# 编辑器 / 会话临时文件 # 编辑器 / 会话临时文件
.zcode/ .zcode/
# 构建产物(每次打包重新生成)
SHA256SUMS
+39 -7
View File
@@ -63,16 +63,48 @@ npm run build
--- ---
## 4. 自动化构建 (推荐方式) ## 4. 分支与发布通道
本项目依赖 GitHub Actions 进行稳定构建,避免本地环境差异导致的编译问题。 | 分支 | 通道 | 包内 `updateJson` | 说明 |
| --- | --- | --- | --- |
| `dev` | 开发 | 无 | 日常开发;产物为 Actions artifact,手动刷入 |
| `beta` | 预览 | `beta/update-beta.json` | 预发布版,GitHub Release 标记为 prerelease |
| `main` | 正式 | `main/update.json` | 正式版 |
### 触发流程 通道由**刷入的包**决定:KernelSU 只读取已安装模块 `module.prop` 里的 `updateJson`,
所以正式版用户永远不会收到 beta 包,反之亦然。`zipUrl` 必须指向 GitHub Release 资产
(或 raw),不再使用第三方镜像。
1. **推送代码**:修改代码并 `git push` 后,GitHub 会自动启动 [Build & Package Module] 工作流。 ### 版本号规范
2. **下载产物**:
- 流程结束后,在 GitHub Actions 运行记录的 **Artifacts** 栏目中可下载编译好的 ZIP 模块。 `versionCode = 基础号 × 100 + 段位`:
- 产物文件名格式为:`LuminPro_V2.x.x-shortsha.zip`。
| 段位 | 范围 | 示例 |
| --- | --- | --- |
| 正式 | `00` | `V2.5-2501` → `250100` |
| beta | `51–99` | `V2.5-2501-beta.1` → `250151` |
| dev | `01–49` | `V2.5-2501-dev.3` → `250103` |
排序恒为 `dev < beta < 下一个正式版`:dev 测试者可平滑收到 beta,beta 用户会平滑收到
下一个正式版。同周期内从 beta/dev 回退到正式版需手动刷包(管理器不支持降级)。
### 发布流程
```bash
# 1) 在对应分支改 module.prop 的 version / versionCode
# 2) 生成更新清单(会写入 update.json / update-beta.json,需一并提交)
node build-module.js --channel=stable # main 分支
node build-module.js --channel=beta # beta 分支
# 3) 提交后打 tag(tag 名 = 版本号小写),推送即触发 CI 建 Release
git tag v2.5-2501-beta.1 && git push origin v2.5-2501-beta.1
```
CI 会依次:跑 Go 单测 → 交叉编译 → 按通道打包 → 建 GitHub Release 并上传
`LuminPro_<version>.zip`(beta 自动标记 prerelease)。更新清单里的 `zipUrl` 精确指向该
资产,所以**版本号与资产文件名必须一致**。
分支推送(非 tag)只产出带短哈希的 artifact,不建 Release;默认通道是 `dev`,本地
`node build-module.js` 不会改动任何清单文件。
--- ---
+11
View File
@@ -80,6 +80,17 @@ _基于 KernelSU WebUI + Go 事件驱动架构_
3. 重启设备生效。 3. 重启设备生效。
4. 在管理器模块设置页调整各项参数,点击保存立即生效。 4. 在管理器模块设置页调整各项参数,点击保存立即生效。
## 版本通道
- **正式版**:稳定发布,自动更新只会推正式版
- **预览版 (Beta)**:抢先体验新功能,可能不稳定;刷入 beta 包后会自动跟随 beta 更新
两个通道互不干扰——正式版用户不会收到 beta 包。预览版用户在下一个正式版发布时会自动
收到正式版;若想提前回到正式版,手动刷入正式版包即可。
下载地址:[GitHub Releases](https://github.com/YuleBest/LuminPro/releases)
(`v*` 为正式版,`*-beta*` 为预览版)
## 注意事项 ## 注意事项
> ⚠️ **OLED 烧屏与发热警告** > ⚠️ **OLED 烧屏与发热警告**
-6
View File
@@ -1,6 +0,0 @@
b1ac7dab449904d761b64b59192b217387ca5ab8b9a36a581c257078c36d8032 action.sh
02d71e872c7b76a437f17e2e2c94bbe589d668449326873b536a8122d5a71258 bin/luminpro
c8ebe774473772ad08791716546e602533ac1198c0d9abf0e750ff386a1980eb boost.sh
51947b69e81d21b8199b11fd259e0418566c5e646e39d6e46b97b272cbe9b25b customize.sh
da8d6380e9a66cb059a005a1e999ee15cb54dfe74feb9d7cae45e751a2abc58a script/restart.sh
96caeb9deb80a29824e06adc1ca712c4cf10c785c109e02f510c27d612f7cd3a service.sh
+79 -14
View File
@@ -1,8 +1,32 @@
import fs from 'fs' import fs from 'fs'
import path from 'path' import path from 'path'
import os from 'os'
import crypto from 'crypto' import crypto from 'crypto'
import archiver from 'archiver' import archiver from 'archiver'
const REPO = 'YuleBest/LuminPro'
// ---------------------------------
// 发布通道: --channel=dev(默认) | beta | stable
// dev 不写更新清单,包内 module.prop 去掉 updateJson(不参与自动更新)
// beta 写 update-beta.json,包内 module.prop 指向 beta 分支清单
// stable 写 update.json,包内 module.prop 指向 main 分支清单
// 通道由「刷入的包」决定:KernelSU 只读取已安装模块 module.prop 里的 updateJson。
// ---------------------------------
const CHANNELS = {
dev: { manifest: null, jsonBranch: 'dev', nameSuffix: ' (Dev)' },
beta: { manifest: 'update-beta.json', jsonBranch: 'beta', nameSuffix: ' (Beta)' },
stable: { manifest: 'update.json', jsonBranch: 'main', nameSuffix: '' },
}
const channelArg = process.argv.slice(2).find((arg) => arg.startsWith('--channel='))
const channel = channelArg ? channelArg.split('=')[1] : 'dev'
if (!CHANNELS[channel]) {
console.error(`[错误] 未知通道: ${channel}(可选 dev / beta / stable)`)
process.exit(1)
}
const { manifest, jsonBranch, nameSuffix } = CHANNELS[channel]
// 读取版本信息用以命名 // 读取版本信息用以命名
const propContent = fs.readFileSync('module.prop', 'utf-8') const propContent = fs.readFileSync('module.prop', 'utf-8')
const versionMatch = propContent.match(/^version=(.*)$/m) const versionMatch = propContent.match(/^version=(.*)$/m)
@@ -13,23 +37,55 @@ const versionCodeStr = versionCodeMatch ? versionCodeMatch[1].trim() : '0000'
const versionCode = parseInt(versionCodeStr, 10) const versionCode = parseInt(versionCodeStr, 10)
const zipName = `LuminPro_${version}.zip` const zipName = `LuminPro_${version}.zip`
// 发布 tag 约定为版本号小写,Release 资产文件名即 zipName
const tag = version.toLowerCase()
const zipUrl = `https://github.com/${REPO}/releases/download/${tag}/${zipName}`
// --- 新增: 自动同步 update.json --- console.log(`\n>>> 通道: ${channel} | 版本: ${version} (${versionCode})`)
const updateJsonPath = 'update.json'
if (fs.existsSync(updateJsonPath)) { // --- 同步更新清单(仅 stable / beta)---
try { if (manifest) {
const updateJson = JSON.parse(fs.readFileSync(updateJsonPath, 'utf-8')) const payload = {
updateJson.versionCode = versionCode versionCode,
updateJson.version = version version,
updateJson.zipUrl = `https://share.yule.ink/magisk/mod/luminpro/module/${zipName}` zipUrl,
updateJson.changelog = `https://raw.githubusercontent.com/YuleBest/LuminPro/main/changelog.md` changelog: `https://raw.githubusercontent.com/${REPO}/${jsonBranch}/changelog.md`,
fs.writeFileSync(updateJsonPath, JSON.stringify(updateJson, null, 4), 'utf-8')
console.log(`>>> [1/3] 已同步 update.json (版本: ${version}, Code: ${versionCode})`)
} catch (e) {
console.error(`[错误] 无法更新 update.json: ${e.message}`)
} }
fs.writeFileSync(manifest, JSON.stringify(payload, null, 4) + '\n', 'utf-8')
console.log(`>>> [1/3] 已写入 ${manifest}`)
console.log(` zipUrl: ${zipUrl}`)
} else {
console.log('>>> [1/3] dev 通道不生成更新清单')
} }
// ---------------------------------
// --- 生成通道专用的 module.prop(不改动仓库内文件)---
const propEntries = []
for (const line of propContent.split('\n')) {
const trimmed = line.trim()
if (!trimmed || trimmed.startsWith('#')) continue
const idx = trimmed.indexOf('=')
if (idx > 0) propEntries.push([trimmed.slice(0, idx), trimmed.slice(idx + 1)])
}
const setProp = (key, value) => {
const found = propEntries.find(([k]) => k === key)
if (found) found[1] = value
else propEntries.push([key, value])
}
if (nameSuffix) {
const nameEntry = propEntries.find(([k]) => k === 'name')
setProp('name', `${nameEntry ? nameEntry[1] : 'LuminPro'}${nameSuffix}`)
}
if (channel === 'dev') {
const idx = propEntries.findIndex(([k]) => k === 'updateJson')
if (idx >= 0) propEntries.splice(idx, 1)
} else {
setProp('updateJson', `https://raw.githubusercontent.com/${REPO}/${jsonBranch}/${manifest}`)
}
const generatedProp = propEntries.map(([k, v]) => `${k}=${v}`).join('\n') + '\n'
const propTmpPath = path.join(os.tmpdir(), `luminpro-module-${process.pid}.prop`)
fs.writeFileSync(propTmpPath, generatedProp, 'utf-8')
// 明确需要忽略的文件清单 // 明确需要忽略的文件清单
const excludes = [ const excludes = [
@@ -89,6 +145,7 @@ const archive = archiver('zip', {
}) })
output.on('close', function () { output.on('close', function () {
fs.rmSync(propTmpPath, { force: true })
console.log(`-----------------------------------`) console.log(`-----------------------------------`)
console.log(`>>> [成功] 打包完成!`) console.log(`>>> [成功] 打包完成!`)
console.log(`输出文件: ${zipName}`) console.log(`输出文件: ${zipName}`)
@@ -104,6 +161,7 @@ archive.on('warning', function (err) {
}) })
archive.on('error', function (err) { archive.on('error', function (err) {
fs.rmSync(propTmpPath, { force: true })
throw err throw err
}) })
@@ -132,6 +190,10 @@ let addedItems = []
for (const dirent of dirContents) { for (const dirent of dirContents) {
const name = dirent.name const name = dirent.name
// module.prop 用通道专用副本替代,跳过仓库内的原文件
if (name === 'module.prop') {
continue
}
// 排除黑名单文件夹,同时排除当前目录下已经打包生成的其它压缩包(避免俄罗斯套娃) // 排除黑名单文件夹,同时排除当前目录下已经打包生成的其它压缩包(避免俄罗斯套娃)
if (!excludes.includes(name) && !name.endsWith('.zip')) { if (!excludes.includes(name) && !name.endsWith('.zip')) {
addedItems.push(name) addedItems.push(name)
@@ -143,6 +205,9 @@ for (const dirent of dirContents) {
} }
} }
archive.file(propTmpPath, { name: 'module.prop' })
addedItems.push('module.prop')
console.log(`正在打包以下内容: \n${addedItems.join(', ')}\n`) console.log(`正在打包以下内容: \n${addedItems.join(', ')}\n`)
archive.finalize() archive.finalize()
+1
View File
@@ -6,6 +6,7 @@
"scripts": { "scripts": {
"dev": "cd webui && vite", "dev": "cd webui && vite",
"build": "cd webui && vite build && cd .. && node build-module.js", "build": "cd webui && vite build && cd .. && node build-module.js",
"build:webui": "cd webui && vite build",
"preview": "cd webui && vite preview", "preview": "cd webui && vite preview",
"lint": "oxlint webui/", "lint": "oxlint webui/",
"lint:fix": "oxlint --fix webui/", "lint:fix": "oxlint --fix webui/",
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"versionCode": 2401, "versionCode": 2401,
"version": "V2.4-2401", "version": "V2.4-2401",
"zipUrl": "https://share.yule.ink/magisk/mod/luminpro/module/LuminPro_V2.4-2401.zip", "zipUrl": "https://github.com/YuleBest/LuminPro/releases/download/v2.4-2401/LuminPro_V2.4-2401-f2c489e.zip",
"changelog": "https://raw.githubusercontent.com/YuleBest/LuminPro/main/changelog.md" "changelog": "https://raw.githubusercontent.com/YuleBest/LuminPro/main/changelog.md"
} }
+11 -1
View File
@@ -26,6 +26,13 @@ const trackStyle = computed(() => {
return { transform: `translateX(${-idx * 100}%)` } return { transform: `translateX(${-idx * 100}%)` }
}) })
const moduleVersion = ref('') const moduleVersion = ref('')
// 通道徽标:版本号里带 -beta / -dev 即为对应通道(打包时写入)
const channelBadge = computed(() => {
const v = moduleVersion.value.toLowerCase()
if (v.includes('-beta')) return 'Beta'
if (v.includes('-dev')) return 'Dev'
return ''
})
const status = useStatus() const status = useStatus()
const config = useConfig() const config = useConfig()
const log = useLog() const log = useLog()
@@ -195,7 +202,10 @@ function handleViewChange(view) {
<div class="header-text"> <div class="header-text">
<h1>LuminPro</h1> <h1>LuminPro</h1>
<p class="header-subtitle">日用屏幕亮度强化</p> <p class="header-subtitle">日用屏幕亮度强化</p>
<p class="header-version">{{ moduleVersion || 'V2.2' }}</p> <p class="header-version">
{{ moduleVersion || 'V2.2' }}
<span v-if="channelBadge" class="version-channel">{{ channelBadge }}</span>
</p>
</div> </div>
</div> </div>
<div class="header-status-container"> <div class="header-status-container">
+13
View File
@@ -67,6 +67,19 @@
text-transform: uppercase; text-transform: uppercase;
} }
/* 版本通道徽标 (Beta / Dev) */
.version-channel {
display: inline-block;
margin-left: 6px;
padding: 1px 6px;
border-radius: 999px;
font-size: 0.6875rem;
font-weight: 700;
color: var(--color-warning);
background: color-mix(in srgb, var(--color-warning) 18%, transparent);
vertical-align: middle;
}
.header-status-container { .header-status-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;