perf: change action #18
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # build.yml | |
| name: Auto Build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| - release-test | |
| tags: | |
| - 'v*' # 添加对标签的监听,所有以v开头的标签都会触发构建 | |
| env: | |
| # Tauri 自动更新签名密钥 | |
| TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
| TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
| # macOS 代码签名 (保留原有的 Xcode 参数) | |
| XCODE_APP_TEAM_ID: ${{ secrets.XCODE_APP_TEAM_ID }} | |
| XCODE_APP_LOADER_EMAIL: ${{ secrets.XCODE_APP_LOADER_EMAIL }} | |
| XCODE_APP_LOADER_PASSWORD: ${{ secrets.XCODE_APP_LOADER_PASSWORD }} | |
| BUILD_CERTIFICATE_BASE64: ${{ secrets.CSC_LINK }} | |
| P12_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
| # Windows 代码签名 | |
| CSC_LINK: ${{ secrets.CSC_LINK }} | |
| CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
| jobs: | |
| release: | |
| name: build and release tauri app | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-14, windows-latest] | |
| steps: | |
| - name: Check out git repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.21' | |
| - name: Build Go client | |
| run: make build-client | |
| working-directory: go-client | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Install system dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.0-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf | |
| - name: Install system dependencies (macOS) | |
| if: matrix.os == 'macos-14' | |
| run: | | |
| brew install create-dmg | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Cache Rust dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| src-tauri/target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Install Tauri CLI | |
| run: cargo install tauri-cli@^2.0 | |
| - name: Install frontend dependencies | |
| run: pnpm install | |
| - name: Build frontend | |
| run: pnpm generate | |
| - name: Build Tauri app (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: pnpm tauri:build | |
| env: | |
| TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
| TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
| - name: Build Tauri app (macOS) | |
| if: matrix.os == 'macos-14' | |
| run: pnpm tauri:build | |
| env: | |
| TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
| TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
| XCODE_APP_TEAM_ID: ${{ secrets.XCODE_APP_TEAM_ID }} | |
| XCODE_APP_LOADER_EMAIL: ${{ secrets.XCODE_APP_LOADER_EMAIL }} | |
| XCODE_APP_LOADER_PASSWORD: ${{ secrets.XCODE_APP_LOADER_PASSWORD }} | |
| BUILD_CERTIFICATE_BASE64: ${{ secrets.CSC_LINK }} | |
| P12_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
| - name: Build Tauri app (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: pnpm tauri:build | |
| env: | |
| TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
| TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
| CSC_LINK: ${{ secrets.CSC_LINK }} | |
| CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
| - name: Upload artifacts (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-app | |
| path: | | |
| src-tauri/target/release/bundle/deb/*.deb | |
| src-tauri/target/release/bundle/rpm/*.rpm | |
| src-tauri/target/release/bundle/appimage/*.AppImage | |
| - name: Upload artifacts (macOS) | |
| if: matrix.os == 'macos-14' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-app | |
| path: | | |
| src-tauri/target/release/bundle/dmg/*.dmg | |
| src-tauri/target/release/bundle/macos/*.app | |
| - name: Upload artifacts (Windows) | |
| if: matrix.os == 'windows-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-app | |
| path: | | |
| src-tauri/target/release/bundle/nsis/*.exe | |
| src-tauri/target/release/bundle/msi/*.msi | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| src-tauri/target/release/bundle/deb/*.deb | |
| src-tauri/target/release/bundle/rpm/*.rpm | |
| src-tauri/target/release/bundle/appimage/*.AppImage | |
| src-tauri/target/release/bundle/dmg/*.dmg | |
| src-tauri/target/release/bundle/macos/*.app | |
| src-tauri/target/release/bundle/nsis/*.exe | |
| src-tauri/target/release/bundle/msi/*.msi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |