diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 58ef681..f41cf9e 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -42,7 +42,7 @@ jobs: run: | uv run pyinstaller lite_mac.spec --noconfirm - # 第 7 步: 创建 macOS 应用包结构 (可选) + # 第 7 步: 创建 macOS 应用包结构 - name: Create macOS app bundle structure run: | mkdir -p dist/DocuTranslate.app/Contents/MacOS @@ -80,16 +80,9 @@ jobs: EOF shell: bash - # 第 8 步: 打包成 zip 文件 - - name: Package application into a zip file - run: | - cd dist - zip -r DocuTranslate-macOS.zip DocuTranslate.app - shell: bash - - # 第 9 步: 上传构建产物 - - name: Upload macOS build artifact + # 第 8 步: 直接上传 .app 文件夹作为构建产物 + - name: Upload macOS application uses: actions/upload-artifact@v4 with: name: DocuTranslate-macOS - path: dist/DocuTranslate-macOS.zip \ No newline at end of file + path: dist/DocuTranslate.app \ No newline at end of file diff --git a/.github/workflows/build-windows-full.yml b/.github/workflows/build-windows-full.yml new file mode 100644 index 0000000..61da3fe --- /dev/null +++ b/.github/workflows/build-windows-full.yml @@ -0,0 +1,50 @@ +name: Build Windows Application + +on: + push: + branches: [ "main" ] + workflow_dispatch: + release: + types: [created] + +jobs: + build-windows: + runs-on: windows-latest + + steps: + # 第 1 步: 检出你的代码 + - name: Checkout repository + uses: actions/checkout@v4 + + # 第 2 步: 设置 Python 环境 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + # 第 3 步: 安装 uv + - name: Install uv + run: powershell -c "irm https://astral.sh/uv/install.ps1 | iex" + - name: Add uv to PATH + run: echo "$env:APPDATA\uv\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + # 第 4 步: 安装依赖 + - name: Install dependencies with uv + run: uv sync + + # 第 5 步: 安装 UPX (简化版本) + - name: Install UPX + run: | + choco install upx -y + + # 第 6 步: 运行 PyInstaller + - name: Build the application with PyInstaller + run: | + uv run pyinstaller lite.spec --noconfirm + + # 第 7 步: 上传 exe 文件作为构建产物 + - name: Upload Windows executable + uses: actions/upload-artifact@v4 + with: + name: DocuTranslate-Windows + path: dist/*.exe \ No newline at end of file diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index f575847..61da3fe 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -42,16 +42,9 @@ jobs: run: | uv run pyinstaller lite.spec --noconfirm - # 第 7 步: 打包成 zip (使用通配符匹配版本号) - - name: Package executable into a zip file - run: | - $exeFile = Get-ChildItem -Path "dist" -Name "DocuTranslate-*-win.exe" - Compress-Archive -Path "dist/$exeFile" -DestinationPath "dist/DocuTranslate-Windows.zip" - shell: powershell - - # 第 8 步: 上传构建产物 - - name: Upload Windows build artifact + # 第 7 步: 上传 exe 文件作为构建产物 + - name: Upload Windows executable uses: actions/upload-artifact@v4 with: name: DocuTranslate-Windows - path: dist/DocuTranslate-Windows.zip \ No newline at end of file + path: dist/*.exe \ No newline at end of file