diff --git a/.github/workflows/release-tauri.yml b/.github/workflows/release-tauri.yml new file mode 100644 index 00000000..0b36a6c2 --- /dev/null +++ b/.github/workflows/release-tauri.yml @@ -0,0 +1,108 @@ +name: Release Tauri (cross-platform) +# 触发条件: +# - 推 v*.*.*-tauri 形式的 tag(与老 Swift 版的 vX.Y.Z 区分开,不冲突) +# - 手动 dispatch(用于测试构建,不发版) +# +# 输出: +# macOS arm64 .dmg + Windows x64 .msi/.exe,自动作为 GitHub Release 资产上传。 +# +# 已知限制(坦诚写在这里): +# - macOS 是 ad-hoc 签名(codesign --sign -),首次启动用户要右键打开。要 Developer ID +# 签名 + 公证需要 Apple 开发者账号 + APPLE_* 一组 secrets,见 tauri-action 文档。 +# - Windows 没签名(无证书),Win 11 SmartScreen 会警告 "未识别的发布者",用户点"仍要运行"。 +# - 任意一个 platform 失败不影响另一个继续构建(fail-fast: false)。 + +on: + push: + tags: + - 'v*-tauri' + workflow_dispatch: + +jobs: + build: + permissions: + contents: write + strategy: + fail-fast: false + matrix: + include: + - platform: macos-latest + rust-target: aarch64-apple-darwin + - platform: windows-latest + rust-target: x86_64-pc-windows-msvc + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: 'openless -all/app/package-lock.json' + + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.rust-target }} + + - name: Cache Cargo + uses: swatinem/rust-cache@v2 + with: + workspaces: 'openless -all/app/src-tauri -> target' + + - name: Install npm deps + working-directory: 'openless -all/app' + run: npm ci + + # ── macOS:用我们自己的 build-mac.sh,它包含 Info.plist 后注入 + ad-hoc 重签 ── + - name: Build (macOS) + if: matrix.platform == 'macos-latest' + working-directory: 'openless -all/app' + env: + INSTALL: '0' # CI 不要装到 /Applications,也不要 reset TCC + run: bash scripts/build-mac.sh + + # ── Windows:直接 tauri build,无 Info.plist 后处理 ── + - name: Build (Windows) + if: matrix.platform == 'windows-latest' + working-directory: 'openless -all/app' + run: npm run tauri build + + # ── 收集产物 ── + - name: List artifacts (debug) + shell: bash + working-directory: 'openless -all/app/src-tauri/target/release/bundle' + run: ls -la macos/ dmg/ nsis/ msi/ 2>/dev/null || true + + - name: Upload macOS artifacts + if: matrix.platform == 'macos-latest' + uses: actions/upload-artifact@v4 + with: + name: openless-macos-arm64 + path: | + openless -all/app/src-tauri/target/release/bundle/dmg/*.dmg + if-no-files-found: error + + - name: Upload Windows artifacts + if: matrix.platform == 'windows-latest' + uses: actions/upload-artifact@v4 + with: + name: openless-windows-x64 + path: | + openless -all/app/src-tauri/target/release/bundle/nsis/*.exe + openless -all/app/src-tauri/target/release/bundle/msi/*.msi + if-no-files-found: error + + # ── tag 推送时,同步上传到 GitHub Release ── + - name: Create / update release + if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-tauri') + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.ref_name }} + name: 'OpenLess ${{ github.ref_name }}' + draft: false + prerelease: false + generate_release_notes: true + files: | + openless -all/app/src-tauri/target/release/bundle/dmg/*.dmg + openless -all/app/src-tauri/target/release/bundle/nsis/*.exe + openless -all/app/src-tauri/target/release/bundle/msi/*.msi diff --git a/openless -all/app/.gitignore b/openless -all/app/.gitignore new file mode 100644 index 00000000..112f301d --- /dev/null +++ b/openless -all/app/.gitignore @@ -0,0 +1,10 @@ +node_modules/ +dist/ +.DS_Store +*.local +.env +.vite/ + +# Tauri +src-tauri/target/ +src-tauri/gen/ diff --git a/openless -all/app/index.html b/openless -all/app/index.html new file mode 100644 index 00000000..02569c7f --- /dev/null +++ b/openless -all/app/index.html @@ -0,0 +1,12 @@ + + +
+ + +