跨平台编译
Tauri 只能构建当前操作系统的对应的应用,官方提供了 GitHub Actions 脚本来进行跨平台编译。
对GitHub Actions不太熟悉的,可以先了解一下。
Github Action 使用
在根目录创建 .github/workflows/release.yml
name: 'Release'on:push:tags:- 'v*'workflow_dispatch:jobs:release:strategy:fail-fast: falsematrix:platform: [macos-latest, ubuntu-latest, windows-latest]runs-on: ${{ matrix.platform }}steps:- name: Checkout repositoryuses: actions/checkout@v2- name: Node.js setupuses: actions/setup-node@v1with:node-version: 16- name: Rust setupuses: actions-rs/toolchain@v1with:toolchain: stable- name: Install dependencies (ubuntu only)if: matrix.platform == 'ubuntu-latest'run: |sudo apt-get updatesudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf- name: Install app dependencies and build webrun: yarn && yarn build- name: Build the appuses: tauri-apps/tauri-action@v0env:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}with:tagName: v__VERSION__ # tauri-action replaces \_\_VERSION\_\_ with the app versionreleaseName: 'v__VERSION__'releaseBody: 'See the assets to download this version and install.'releaseDraft: trueprerelease: false
直接使用的官方给的例子,流程就是打以 v 开头的 tag,触发构建,构建成功后自动创建 release 草稿,并附上制品。
