| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- name: Release
- on:
- push:
- tags:
- - 'v*'
- jobs:
- # 第一步:并行构建所有平台
- build:
- strategy:
- fail-fast: false
- matrix:
- include:
- - os: windows-latest
- platform: win
- target: x86_64-pc-windows-msvc
- - os: macos-latest
- platform: mac
- target: aarch64-apple-darwin
- - os: macos-latest
- platform: mac-intel
- target: x86_64-apple-darwin
- - os: ubuntu-22.04
- platform: linux
- target: x86_64-unknown-linux-gnu
- runs-on: ${{ matrix.os }}
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
- - name: Install Rust toolchain
- uses: dtolnay/rust-toolchain@stable
- with:
- targets: ${{ matrix.target }}
- - name: Cache Rust
- uses: Swatinem/rust-cache@v2
- with:
- workspaces: src-tauri -> target
- cache-targets: true
- shared-key: ${{ matrix.target }}
- - name: Install Linux dependencies (cached)
- if: matrix.platform == 'linux'
- uses: awalsh128/cache-apt-pkgs-action@latest
- with:
- packages: libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libgtk-3-dev
- version: 1.0
- - name: Install dependencies
- run: npm ci
- - name: Build application (Windows)
- if: matrix.platform == 'win'
- env:
- TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
- TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ""
- run: node scripts/build.js --target ${{ matrix.target }}
- - name: Build application (macOS/Linux)
- if: matrix.platform != 'win'
- env:
- TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
- TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ""
- run: |
- chmod +x build-mac.sh build-linux.sh
- node scripts/build.js --target ${{ matrix.target }}
- - name: Upload artifacts
- uses: actions/upload-artifact@v4
- with:
- name: artifacts-${{ matrix.platform }}
- path: built/*
- if-no-files-found: error
- # 第二步:创建 Release 并上传所有产物
- release:
- needs: build
- runs-on: ubuntu-latest
- permissions:
- contents: write
- steps:
- - name: Download all artifacts
- uses: actions/download-artifact@v4
- with:
- path: artifacts
- pattern: artifacts-*
- merge-multiple: true
- - name: List artifacts
- run: ls -la artifacts/
- - name: Create Release
- uses: softprops/action-gh-release@v1
- with:
- body: |
- ## Downloads
- ### Windows
- - `*-win-x64-setup.exe` - NSIS 安装程序 (推荐)
- - `*-win-x64-portable.exe` - 便携版
- - `*-win-x64.msi` - MSI 安装程序
- ### macOS
- - `*-mac-arm64.dmg` - Apple Silicon (M1/M2/M3)
- - `*-mac-x64.dmg` - Intel
- ### Linux
- - `*-linux-x64.deb` - Debian/Ubuntu
- - `*-linux-x64.AppImage` - 通用 AppImage
- draft: false
- prerelease: false
- files: artifacts/*
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|