| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- name: Build Windows
- on:
- workflow_dispatch: # 手动触发,用于单独调试
- workflow_call: # 被其他工作流调用
- jobs:
- build:
- runs-on: windows-latest
- 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: x86_64-pc-windows-msvc
- - name: Cache Rust
- uses: Swatinem/rust-cache@v2
- with:
- workspaces: src-tauri -> target
- cache-targets: true
- shared-key: x86_64-pc-windows-msvc
- - name: Install dependencies
- run: npm ci
- - name: Build application
- env:
- TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
- TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ""
- shell: pwsh
- run: |
- $keyPath = ".keys/tauri-signing.key"
- if (Test-Path $keyPath) {
- $env:TAURI_SIGNING_PRIVATE_KEY = Get-Content $keyPath -Raw
- }
- node scripts/build.js --target x86_64-pc-windows-msvc
- - name: Upload artifacts
- uses: actions/upload-artifact@v4
- with:
- name: artifacts-win
- path: built/*
- if-no-files-found: error
|