tauri v2 最新版github CI/CD配置文件

tauri v2如果使用v1的配置文件就会报错,下面是适合v2的版本,自行调整到适合你的项目

name: Release
on:
    push:
        tags:
            - 'v*'
    workflow_dispatch:
 
jobs:
    release:
        permissions:
            contents: write
        strategy:
            fail-fast: false
            matrix:
                platform: [macos-latest, ubuntu-latest, windows-latest]
        runs-on: ${{ matrix.platform }}
 
        steps:
            - name: Checkout repository
              uses: actions/checkout@v3
 
            - name: Install dependencies (ubuntu only)
              if: matrix.platform == 'ubuntu-latest'
              # You can remove libayatana-appindicator3-dev if you don't use the system tray feature.
              run: |
                  sudo apt-get update
                  sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev
            - name: Rust setup
              uses: dtolnay/rust-toolchain@stable
            - name: Rust cache
              uses: swatinem/rust-cache@v2
              with:
                  workspaces: './src-tauri -> target'
            - name: Sync node version and setup cache
              uses: actions/setup-node@v4
              with:
                  node-version: 20
            - name: Install yarn
              run: npm i -g yarn
            - name: Install frontend dependencies
              # If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
              run: yarn install # Change this to npm, yarn or pnpm.
 
            - name: Build the app
              uses: tauri-apps/tauri-action@v0
 
              env:
                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
              with:
                  tagName: ${{ github.ref_name }} # This only works if your workflow triggers on new tags.
                  releaseName: 'monitor ${{ github.ref_name }}' # tauri-action replaces \_\_VERSION\_\_ with the app version.
                  releaseBody: 'See the assets to download and install this version.根据不同平台下载相应的安装包'
                  releaseDraft: false
                  prerelease: false
                  publish: true
这是一个 Rust 语言的 API 文档,介绍了 Tauri 库版本 1.3.0 中的 `WindowBuilder` 结构体。`WindowBuilder` 结构体是用于创建 Tauri 应用程序窗口的构建器。以下是该文档的翻译: # `WindowBuilder` 用于创建 Tauri 应用程序窗口的构建器。 ## 结构体成员 ### `width` 窗口的宽度。默认值为 `800`。 ### `height` 窗口的高度。默认值为 `600`。 ### `title` 窗口的标题。默认值为 `Tauri Application`。 ### `resizable` 窗口是否可以调整大小。默认为 `true`。 ### `fullscreen` 窗口是否全屏。默认为 `false`。 ### `fullscreenable` 窗口是否可以全屏。默认为 `true`。 ### `decorations` 窗口是否有装饰。默认为 `true`。 ### `transparent` 窗口是否透明。默认为 `false`。 ### `always_on_top` 窗口是否总在最上层。默认为 `false`。 ### `icon` 窗口的图标。默认为 `None`。 ### `min_width` 窗口的最小宽度。默认为 `None`。 ### `min_height` 窗口的最小高度。默认为 `None`。 ### `max_width` 窗口的最大宽度。默认为 `None`。 ### `max_height` 窗口的最大高度。默认为 `None`。 ### `inner_border` 窗口是否有内边框。默认为 `true`。 ### `platform_specific` 在某些平台上启用特定于平台的外观和行为。默认为 `true`。 ## 方法 ### `new() -> WindowBuilder` 创建新的 `WindowBuilder` 实例。 ### `build(&self) -> Result<Window, String>` 使用该构建器创建并返回一个新的 `Window` 实例。如果构建器的参数不正确,则返回一个 `Err`。 ### `with_title<S: Into<String>>(mut self, title: S) -> Self` 设置窗口标题。 ### `with_width(mut self, width: f64) -> Self` 设置窗口的宽度。 ### `with_height(mut self, height: f64) -> Self` 设置窗口的高度。 ### `with_resizable(mut self, resizable: bool) -> Self` 设置窗口是否可以调整大小。 ### `with_fullscreen(mut self, fullscreen: bool) -> Self` 设置窗口是否全屏。 ### `with_fullscreenable(mut self, fullscreenable: bool) -> Self` 设置窗口是否可以全屏。 ### `with_decorations(mut self, decorations: bool) -> Self` 设置窗口是否有装饰。 ### `with_transparent(mut self, transparent: bool) -> Self` 设置窗口是否透明。 ### `with_always_on_top(mut self, always_on_top: bool) -> Self` 设置窗口是否总在最上层。 ### `with_icon(mut self, icon: Icon) -> Self` 设置窗口的图标。 ### `with_min_width(mut self, min_width: f64) -> Self` 设置窗口的最小宽度。 ### `with_min_height(mut self, min_height: f64) -> Self` 设置窗口的最小高度。 ### `with_max_width(mut self, max_width: f64) -> Self` 设置窗口的最大宽度。 ### `with_max_height(mut self, max_height: f64) -> Self` 设置窗口的最大高度。 ### `with_inner_border(mut self, inner_border: bool) -> Self` 设置窗口是否有内边框。 ### `with_platform_specific(mut self, platform_specific: bool) -> Self` 设置是否在某些平台上启用特定于平台的外观和行为。 ## 示例 ```rust use tauri::WindowBuilder; let builder = WindowBuilder::new() .with_title("My App") .with_width(800.0) .with_height(600.0); let window = builder.build().unwrap(); ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值