Update: Build scripts and project documentation - 2026-04-03 19:05:44
Some checks failed
flutter analysis / check (push) Has been cancelled
Some checks failed
flutter analysis / check (push) Has been cancelled
This commit is contained in:
54
build_and_push.sh
Executable file
54
build_and_push.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
# 完整构建和上传脚本
|
||||
|
||||
set -e
|
||||
|
||||
echo "=== ServerBox 完整构建脚本 ==="
|
||||
|
||||
# 配置环境
|
||||
export PATH="$PATH:/opt/flutter/bin"
|
||||
export ANDROID_HOME=/opt/android-sdk
|
||||
export ANDROID_SDK_ROOT=/opt/android-sdk
|
||||
|
||||
cd /root/.openclaw/workspace/flutter_opencode_client
|
||||
|
||||
echo "=== 步骤 1: 获取 Flutter 依赖 ==="
|
||||
flutter pub get
|
||||
|
||||
echo "=== 步骤 2: 构建 Release APK ==="
|
||||
flutter build apk --release
|
||||
|
||||
APK_PATH="build/app/outputs/flutter-apk/app-release.apk"
|
||||
if [ -f "$APK_PATH" ]; then
|
||||
echo ""
|
||||
echo "=== APK 构建成功! ==="
|
||||
echo "APK 路径: $PWD/$APK_PATH"
|
||||
ls -lh "$APK_PATH"
|
||||
|
||||
# 复制 APK 到项目根目录
|
||||
cp "$APK_PATH" ./app-release.apk
|
||||
echo "APK 已复制到: $PWD/app-release.apk"
|
||||
else
|
||||
echo ""
|
||||
echo "=== APK 构建失败 ==="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== 步骤 3: 配置 Git 仓库 ==="
|
||||
git remote add opencode ssh://git@git.wqyblog.cn:2222/wuqiyang312/flutter_opencode_client.git 2>/dev/null || git remote set-url opencode ssh://git@git.wqyblog.cn:2222/wuqiyang312/flutter_opencode_client.git
|
||||
|
||||
echo ""
|
||||
echo "=== 步骤 4: 提交更改 ==="
|
||||
git add -A
|
||||
git commit -m "Build: Release APK v1.0.1352 - $(date '+%Y-%m-%d %H:%M:%S')" || echo "Nothing to commit"
|
||||
|
||||
echo ""
|
||||
echo "=== 步骤 5: 推送到远程仓库 ==="
|
||||
echo "推送到 opencode..."
|
||||
git push -u opencode main --force
|
||||
|
||||
echo ""
|
||||
echo "=== 完成! ==="
|
||||
echo "APK 路径: $PWD/app-release.apk"
|
||||
echo "Git 仓库: ssh://git@git.wqyblog.cn:2222/wuqiyang312/flutter_opencode_client.git"
|
||||
Reference in New Issue
Block a user