mirror of
https://github.com/hotwa/luci-app-openclaw.git
synced 2026-03-30 20:25:44 +00:00
140 lines
4.4 KiB
YAML
140 lines
4.4 KiB
YAML
name: Build & Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: '版本号 (留空则读取 VERSION 文件)'
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
create_release:
|
|
description: '是否创建 Release'
|
|
required: false
|
|
type: boolean
|
|
default: true
|
|
upload_openlist:
|
|
description: '是否上传到 OpenList 网盘'
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
|
|
jobs:
|
|
build:
|
|
name: Build packages
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Determine version
|
|
id: version
|
|
run: |
|
|
INPUT_VER="${{ github.event.inputs.version }}"
|
|
if [ -n "$INPUT_VER" ]; then
|
|
VER="$INPUT_VER"
|
|
elif [ -f VERSION ]; then
|
|
VER="$(cat VERSION | tr -d '[:space:]')"
|
|
else
|
|
VER="$(date -u +%Y.%m.%d)"
|
|
fi
|
|
echo "version=$VER" >> "$GITHUB_OUTPUT"
|
|
echo "tag=v$VER" >> "$GITHUB_OUTPUT"
|
|
echo "Version: $VER"
|
|
|
|
- name: Extract build versions from source
|
|
id: build_versions
|
|
run: |
|
|
# 从 openclaw-env 中提取版本号 (唯一的版本真相源)
|
|
NODE_VER=$(grep -oP 'NODE_VERSION="\$\{NODE_VERSION:-\K[0-9.]+' root/usr/bin/openclaw-env)
|
|
OC_VER=$(grep -oP 'OC_TESTED_VERSION="\K[0-9.]+' root/usr/bin/openclaw-env)
|
|
echo "node_version=${NODE_VER}" >> "$GITHUB_OUTPUT"
|
|
echo "oc_version=${OC_VER}" >> "$GITHUB_OUTPUT"
|
|
echo "Node.js: v${NODE_VER}"
|
|
echo "OpenClaw: v${OC_VER}"
|
|
|
|
- name: Inject version
|
|
run: |
|
|
VER="${{ steps.version.outputs.version }}"
|
|
echo "$VER" > VERSION
|
|
# 同步到 Makefile
|
|
sed -i "s/^PKG_VERSION:=.*/PKG_VERSION:=$VER/" Makefile
|
|
|
|
- name: Build .run installer (online)
|
|
run: |
|
|
chmod +x scripts/build_run.sh
|
|
sh scripts/build_run.sh dist
|
|
|
|
- name: Build .ipk package
|
|
run: |
|
|
chmod +x scripts/build_ipk.sh
|
|
sh scripts/build_ipk.sh dist
|
|
|
|
- name: List outputs
|
|
run: |
|
|
echo "=== Build artifacts ==="
|
|
ls -lh dist/
|
|
echo ""
|
|
echo "=== SHA256 checksums ==="
|
|
sha256sum dist/*.run dist/*.ipk 2>/dev/null || true
|
|
|
|
- name: Extract changelog
|
|
id: changelog
|
|
run: |
|
|
VER="${{ steps.version.outputs.version }}"
|
|
CHANGELOG=$(awk "/^## \\[${VER}\\]/{found=1; next} /^## \\[/{if(found) exit} found{print}" CHANGELOG.md)
|
|
if [ -z "$CHANGELOG" ]; then
|
|
CHANGELOG="暂无更新日志"
|
|
fi
|
|
{
|
|
echo "content<<CHANGELOG_EOF"
|
|
echo "$CHANGELOG"
|
|
echo "CHANGELOG_EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: luci-app-openclaw-${{ steps.version.outputs.version }}
|
|
path: dist/*
|
|
retention-days: 30
|
|
compression-level: 0
|
|
|
|
- name: Upload to OpenList (online)
|
|
if: github.event.inputs.upload_openlist == 'true'
|
|
run: |
|
|
chmod +x scripts/upload_openlist.sh
|
|
sh scripts/upload_openlist.sh dist/
|
|
env:
|
|
OPENLIST_URL: ${{ secrets.OPENLIST_URL }}
|
|
OPENLIST_USER: ${{ secrets.OPENLIST_USER }}
|
|
OPENLIST_PASS: ${{ secrets.OPENLIST_PASS }}
|
|
OPENLIST_PATH: ${{ secrets.OPENLIST_PATH }}
|
|
|
|
- name: Create Release
|
|
if: github.event.inputs.create_release == 'true'
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.version.outputs.tag }}
|
|
name: ${{ steps.version.outputs.version }}
|
|
files: dist/*
|
|
draft: false
|
|
prerelease: false
|
|
body: |
|
|
${{ steps.changelog.outputs.content }}
|
|
|
|
---
|
|
|
|
**在线安装** (需联网,自动下载 Node.js + OpenClaw)
|
|
```
|
|
# iStoreOS
|
|
sh luci-app-openclaw_${{ steps.version.outputs.version }}.run
|
|
|
|
# OpenWrt
|
|
opkg install luci-app-openclaw_${{ steps.version.outputs.version }}-1_all.ipk
|
|
```
|
|
|
|
[使用文档](https://github.com/10000ge10000/luci-app-openclaw#readme) · [问题反馈](https://github.com/10000ge10000/luci-app-openclaw/issues) · [B站](https://space.bilibili.com/59438380) · [博客](https://blog.910501.xyz/)
|