修正windows在线打包

(cherry picked from commit dae69f6c0e25bc1ba80fc1b52bdfbf255f1a5f51)
This commit is contained in:
Rust 2025-10-29 11:38:09 +08:00 committed by speakeloudest
parent 8204895199
commit fde4bfa464
2 changed files with 116 additions and 4 deletions

View File

@ -381,7 +381,39 @@ jobs:
uses: actions/download-artifact@v4
with:
name: libcore-windows
path: libcore/bin/
path: .
- name: 🔧 复制 libcore 文件到正确位置并重命名
shell: bash
run: |
echo "📋 复制 libcore 文件..."
# 确保目标目录存在
mkdir -p libcore/bin
# 复制并重命名文件
if [ -f "HiddifyCli.exe" ]; then
echo "✅ 找到 HiddifyCli.exe重命名为 BearVPNCli.exe"
cp HiddifyCli.exe libcore/bin/BearVPNCli.exe
fi
if [ -f "libcore.dll" ]; then
echo "✅ 找到 libcore.dll"
cp libcore.dll libcore/bin/
fi
# 如果下载到子目录,也需要处理
if [ -d "libcore-windows" ]; then
if [ -f "libcore-windows/HiddifyCli.exe" ]; then
cp libcore-windows/HiddifyCli.exe libcore/bin/BearVPNCli.exe
fi
if [ -f "libcore-windows/libcore.dll" ]; then
cp libcore-windows/libcore.dll libcore/bin/
fi
fi
echo "📄 验证文件..."
ls -lh libcore/bin/ || echo "目录为空"
- name: ⚙️ 配置 API、OSS 和加密密钥
shell: bash

View File

@ -8,11 +8,91 @@ on:
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
# 先编译 libcore
build-libcore:
name: 编译 libcore (Windows)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 📥 Checkout 代码
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: 🔧 设置 Go 环境
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: true
cache-dependency-path: libcore/go.sum
- name: 🔧 设置 Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: 🔧 安装 MinGW
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64
- name: 📦 编译 libcore.dll
working-directory: libcore
run: |
echo "🚀 开始编译 Windows libcore..."
make windows-amd64
if [ -f "bin/libcore.dll" ] && [ -f "bin/HiddifyCli.exe" ]; then
echo "✅ Windows libcore 编译成功"
ls -lh bin/
else
echo "❌ Windows libcore 编译失败"
exit 1
fi
- name: 📤 上传 Windows libcore
uses: actions/upload-artifact@v4
with:
name: libcore-windows
path: |
libcore/bin/libcore.dll
libcore/bin/HiddifyCli.exe
libcore/bin/webui/**
retention-days: 7
# 构建 Windows 应用
build:
runs-on: windows-latest
needs: build-libcore
steps:
- name: 📥 Checkout 代码
uses: actions/checkout@v4
- name: 📥 下载 libcore
uses: actions/download-artifact@v4
with:
name: libcore-windows
path: .
- name: 🔧 复制 libcore 文件到正确位置并重命名
run: |
echo "📋 复制 libcore 文件..."
if (Test-Path "HiddifyCli.exe") {
Write-Host "✅ 找到 HiddifyCli.exe重命名为 BearVPNCli.exe"
Copy-Item HiddifyCli.exe libcore\bin\BearVPNCli.exe
}
if (Test-Path "libcore.dll") {
Write-Host "✅ 找到 libcore.dll"
New-Item -ItemType Directory -Force -Path libcore\bin
Copy-Item libcore.dll libcore\bin\
}
Write-Host "📄 验证文件..."
Get-ChildItem libcore\bin\ -ErrorAction SilentlyContinue | Format-Table
- name: Setup Flutter
uses: subosito/flutter-action@v2