GitHub
Esta página aún no está disponible en tu idioma.
This guide will show you how to use tauri-action in GitHub Actions to easily build and upload your app, and how to make Tauri’s updater query the newly created GitHub release for updates.
Lastly, it will also show how to set up a more complicated build pipeline for Linux Arm AppImages.
Getting Started
To set up tauri-action
you must first set up a GitHub repository. You can also use this action on a repository that does not have Tauri configured yet since it can automatically initialize Tauri for you, please see the action’s readme for necessary configuration options.
Go to the Actions tab on your GitHub project page and select “New workflow”, then choose “Set up a workflow yourself”. Replace the file with the workflow from below or from one of the action’s examples.
Configuration
Please see the tauri-action
readme for all available configuration options.
When your app is not on the root of the repository, use the projectPath
input.
You may freely modify the workflow name, change its triggers, and add more steps such as npm run lint
or npm run test
. The important part is that you keep the below line at the end of the workflow since this runs the build script and releases your app.
How to Trigger
The release workflow shown below and in the tauri-action
examples is triggered by pushed to the release
branch. The action automatically creates a git tag and a title for the GitHub release using the application version.
As another example, you can also change the trigger to run the workflow on the push of a version git tag such as app-v0.7.0
:
For a full list of possible trigger configurations, check out the official GitHub documentation.
Example Workflow
Below is an example workflow that has been set up to run every time you push to the release
branch.
This workflow will build and release your app for Linux x64, Windows x64, macOS x64 and macOS Arm64 (M1 and above).
The steps this workflow takes are:
- Checkout the repository using
actions/checkout@v4
. - Install Linux system dependencies required to build the app.
- Set up Node.js LTS and a cache for global npm/yarn/pnpm package data using
actions/setup-node@v4
. - Set up Rust and a cache for Rust’s build artifacts using
dtolnay/rust-toolchain@stable
andswatinem/rust-cache@v2
. - Install the frontend dependencies and, if not configured as
beforeBuildCommand
, run the web app’s build script. - Lastly, it uses
tauri-apps/tauri-action@v0
to runtauri build
, generate the artifacts, and create a GitHub release.
For more configuration options, check out the tauri-action
repository and its examples.
Arm Runner Compilation
This workflow uses pguyot/arm-runner-action
to compile directly on an emulated Arm runner. This bridges the gap for missing cross-architecture build support in the AppImage tooling.
Troubleshooting
GitHub Environment Token
The GitHub Token is automatically issued by GitHub for each workflow run without further configuration, which means there is no risk of secret leakage. This token however only has read permissions by default and you may get a “Resource not accessible by integration” error when running the workflow. If this happens, you may need to add write permissions to this token. To do this, go to your GitHub project settings, select Actions
, scroll down to Workflow permissions
, and check “Read and write permissions”.
You can see the GitHub Token being passed to the workflow via this line in the workflow:
© 2024 Tauri Contributors. CC-BY / MIT