当前位置: 首页 > article >正文

tauri程序使用github action发布linux中arm架构

Arm Runner 编译

该工作流使用 pguyot/arm-runner-action 直接在仿真 Arm Runner 上进行编译。这弥补了 AppImage 工具中跨架构编译支持的缺失。

arm-runner-action 比 GitHub 的标准运行程序要慢得多,因此在需要按构建分钟数收费的私有软件源中要小心。一个新的 create-tauri-app 项目的无缓存构建需要约 1 个小时。

官方文档有说明:GitHub | Tauri

name: 'Publish Linux Arm builds'

on:
  workflow_dispatch:
  push:
    branches:
      - release

jobs:
  build:
    runs-on: ubuntu-22.04

    strategy:
      matrix:
        arch: [aarch64, armv7l]
        include:
          - arch: aarch64
            cpu: cortex-a72
            base_image: https://dietpi.com/downloads/images/DietPi_RPi-ARMv8-Bookworm.img.xz
            deb: arm64
            rpm: aarch64
            appimage: aarch64
          - arch: armv7l
            cpu: cortex-a53
            deb: armhfp
            rpm: arm
            appimage: armhf
            base_image: https://dietpi.com/downloads/images/DietPi_RPi-ARMv7-Bookworm.img.xz

    steps:
      - uses: actions/checkout@v3

      - name: Cache rust build artifacts
        uses: Swatinem/rust-cache@v2
        with:
          workspaces: src-tauri
          cache-on-failure: true

      - name: Build app
        uses: pguyot/arm-runner-action@v2.6.5
        with:
          base_image: ${{ matrix.base_image }}
          cpu: ${{ matrix.cpu }}
          bind_mount_repository: true
          image_additional_mb: 10240
          optimize_image: no
          #exit_on_fail: no
          commands: |
            # Prevent Rust from complaining about $HOME not matching eid home
            export HOME=/root

            # Workaround to CI worker being stuck on Updating crates.io index
            export CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse

            # Install setup prerequisites
            apt-get update -y --allow-releaseinfo-change
            apt-get autoremove -y
            apt-get install -y --no-install-recommends --no-install-suggests curl libwebkit2gtk-4.1-dev build-essential libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf libfuse2 file
            curl https://sh.rustup.rs -sSf | sh -s -- -y
            . "$HOME/.cargo/env"
            curl -fsSL https://deb.nodesource.com/setup_lts.x | bash
            apt-get install -y nodejs

            # Install frontend dependencies
            npm install

            # Build the application
            npm run tauri build -- --verbose

      - name: Get app version
        run: echo "APP_VERSION=$(jq -r .version src-tauri/tauri.conf.json)" >> $GITHUB_ENV

      # TODO: Combine this with the basic workflow and upload the files to the Release.
      - name: Upload deb bundle
        uses: actions/upload-artifact@v3
        with:
          name: Debian Bundle
          path: ${{ github.workspace }}/src-tauri/target/release/bundle/deb/appname_${{ env.APP_VERSION }}_${{ matrix.deb }}.deb

      - name: Upload rpm bundle
        uses: actions/upload-artifact@v3
        with:
          name: RPM Bundle
          path: ${{ github.workspace }}/src-tauri/target/release/bundle/rpm/appname-${{ env.APP_VERSION }}-1.${{ matrix.rpm }}.rpm

      - name: Upload appimage bundle
        uses: actions/upload-artifact@v3
        with:
          name: AppImage Bundle
          path: ${{ github.workspace }}/src-tauri/target/release/bundle/appimage/appname_${{ env.APP_VERSION }}_${{ matrix.appimage }}.AppImage

故障排除

GitHub 环境令牌

GitHub 会为每个工作流的运行自动签发 GitHub 令牌,无需进一步配置,这意味着不存在泄密风险。不过,该令牌默认只有读取权限,运行工作流时可能会出现 "Resource not access by integration"(集成无法访问资源)错误。如果出现这种情况,您可能需要为该令牌添加写入权限。为此,请进入 GitHub 项目设置,选择 "操作",向下滚动到 "工作流权限",然后选中 "读写权限"。

通过工作流中的这一行,你可以看到 GitHub 令牌被传递到工作流中


http://www.kler.cn/a/581091.html

相关文章:

  • 【计算机网络】域名劫持无处遁形:基于HTTPDNS打造可靠且安全的域名解析体系
  • 【HarmonyOS Next】鸿蒙应用弹框和提示气泡详解(一)
  • HTTP拾技杂谈
  • 汽车一键启动按钮更换注意事项
  • 头歌-Junit实训入门篇
  • 2025华晨宇火星演唱会盛大启幕 中西乐交融视听美学再攀高峰
  • LeeCode题库第五十题
  • mac安装java环境
  • 【面试】计算机网络
  • 在Visual Studio 2022中实现Qt插件开发
  • 蓝桥杯嵌入式组第七届省赛题目解析+STM32G431RBT6实现源码
  • Python从入门到精通1:FastAPI
  • 现代优雅品牌杂志广告邀请函设计衬线手写英文字体 Buttercy Font Duo
  • 深入解析 C 语言中含数组和指针的构造体与共同体内存计算
  • 【数据结构】二叉搜索树、平衡搜索树、红黑树
  • HTML <head> 元素详解:网页头部的关键组成部分
  • ragflow-组件可视化工具 es默认用户名elastic
  • sonarqube+SonarScanner+postpresql+jenkins
  • 解决 React 中的 Hydration Failed 错误
  • 打造智能钉钉机器人:借助智谱GLM-4-Flash实现高效智能回复(文末附源码)