feat: 全平台打包 + CI/CD 自动构建工作流

- 修复移动端: axios替换为原生fetch (React Native兼容)
- 新增 .gitea/workflows/build.yml CI/CD工作流:
  - Windows: NSIS安装包 (windows-latest)
  - macOS: DMG x64+arm64 (macos-latest)
  - Linux: AppImage+deb (ubuntu-latest)
  - Android: APK via expo prebuild + gradle (ubuntu-latest)
  - iOS: simulator build (macos-latest)
  - 移动端JS Bundle导出 (android+ios)
  - 自动创建Release (tag触发)

本地已构建产物:
- client/release/FunConnect-1.1.0-Win-x64.exe (73MB)
- client/release/FunConnect-1.1.0-Linux-x64.zip (99MB)
- mobile JS bundles (android + ios) 已验证导出成功
This commit is contained in:
FunMC
2026-02-23 08:16:28 +08:00
parent 09470c0465
commit 7fdc570391
5 changed files with 14547 additions and 24 deletions

197
.gitea/workflows/build.yml Normal file
View File

@@ -0,0 +1,197 @@
name: Build All Platforms
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
# ==================== Desktop Client (Electron) ====================
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
working-directory: client
- name: Build Windows (x64 NSIS + Portable)
run: npm run dist:win
working-directory: client
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: windows-builds
path: |
client/release/*.exe
client/release/*.exe.blockmap
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
working-directory: client
- name: Build macOS (x64 + arm64 DMG)
run: npm run dist:mac
working-directory: client
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload macOS artifacts
uses: actions/upload-artifact@v4
with:
name: macos-builds
path: |
client/release/*.dmg
client/release/*.dmg.blockmap
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
working-directory: client
- name: Build Linux (AppImage + deb)
run: npm run dist:linux
working-directory: client
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Linux artifacts
uses: actions/upload-artifact@v4
with:
name: linux-builds
path: |
client/release/*.AppImage
client/release/*.deb
# ==================== Mobile Client (Expo / React Native) ====================
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install dependencies
run: npm install
working-directory: mobile
- name: Generate native project
run: npx expo prebuild --platform android --no-install
working-directory: mobile
- name: Build Android APK
run: |
cd android
chmod +x gradlew
./gradlew assembleRelease
working-directory: mobile
- name: Upload Android APK
uses: actions/upload-artifact@v4
with:
name: android-builds
path: mobile/android/app/build/outputs/apk/release/*.apk
build-ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
working-directory: mobile
- name: Generate native project
run: npx expo prebuild --platform ios --no-install
working-directory: mobile
- name: Install CocoaPods
run: cd ios && pod install
working-directory: mobile
- name: Build iOS (unsigned simulator)
run: |
xcodebuild \
-workspace ios/FunConnect.xcworkspace \
-scheme FunConnect \
-configuration Release \
-sdk iphonesimulator \
-derivedDataPath build \
CODE_SIGNING_ALLOWED=NO
working-directory: mobile
- name: Package iOS build
run: |
cd build/Build/Products/Release-iphonesimulator
zip -r ../../../../FunConnect-ios-simulator.zip FunConnect.app
working-directory: mobile
- name: Upload iOS artifacts
uses: actions/upload-artifact@v4
with:
name: ios-builds
path: mobile/FunConnect-ios-simulator.zip
# ==================== Mobile JS Bundles ====================
export-bundles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
working-directory: mobile
- name: Export Android bundle
run: npx expo export --platform android --output-dir release/android-bundle
working-directory: mobile
- name: Export iOS bundle
run: npx expo export --platform ios --output-dir release/ios-bundle
working-directory: mobile
- name: Upload bundles
uses: actions/upload-artifact@v4
with:
name: mobile-bundles
path: |
mobile/release/android-bundle/
mobile/release/ios-bundle/
# ==================== Create Release ====================
release:
needs: [build-windows, build-macos, build-linux, build-android, export-bundles]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: List artifacts
run: find artifacts -type f | head -50
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/windows-builds/*
artifacts/macos-builds/*
artifacts/linux-builds/*
artifacts/android-builds/*
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}