Skip to content

Commit e3ecd71

Browse files
authored
fix: Update github action guide (tauri-apps#1000)
* fix: Update github action guide * Update cross-platform.md
1 parent 96fe986 commit e3ecd71

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

docs/guides/building/cross-platform.md

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@ To setup code signing for both Windows and macOS on your workflow, follow the sp
2727

2828
To set up Tauri Action you must first set up a GitHub repository. You can use this action on a repo that doesn't have Tauri configured since it automatically initializes Tauri before building and configuring it to use your artifacts.
2929

30-
Go to the Actions tab on your GitHub project and choose "New workflow", then choose "Set up a workflow yourself". Replace the file with the [Tauri Action production build workflow example]. Alternatively, you may set up the workflow based on the [example lower on this page](#example-workflow)
30+
Go to the Actions tab on your GitHub project and choose "New workflow", then choose "Set up a workflow yourself". Replace the file with the [Tauri Action production build workflow example]. Alternatively, you may set up the workflow based on the [example at the bottom of this page](#example-workflow)
3131

3232
### Configuration
3333

3434
You can configure Tauri with the `configPath`, `distPath` and `iconPath` options. See the actions Readme for details.
3535

36-
Custom Tauri CLI scripts can be run with the `tauriScript` option. So instead of running `yarn tauri build` or `npx tauri build`, `${tauriScript}` will be executed. This can be useful when you need custom build functionality such as when creating Tauri apps e.g. a `desktop:build` script.
36+
<!-- FIXME: tauriScript is currently broken.
37+
Custom Tauri CLI scripts can be run with the `tauriScript` option. So instead of running `yarn tauri build` or `npx tauri build`, `${tauriScript}` will be executed. This can be useful when you need custom build functionality such as when creating Tauri apps e.g. a `desktop:build` script.
38+
-->
3739

3840
When your app isn't on the root of the repo, use the `projectPath` input.
41+
3942
You may modify the workflow name, change the 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 the artifacts:
4043

4144
```yaml
@@ -44,7 +47,7 @@ You may modify the workflow name, change the triggers, and add more steps such a
4447
4548
### How to Trigger
4649
47-
The release workflow by default is triggered by pushes on the "release" branch. The action automatically creates a tag and title for the GitHub release using the application version specified in `tauri.config.json`.
50+
The release workflow in the README examples linked above is triggered by pushes on the "release" branch. The action automatically creates a tag and title for the GitHub release using the application version specified in `tauri.config.json`.
4851

4952
You can also trigger the workflow on the push of a version tag such as "app-v0.7.0". For this you can change the start of the release workflow:
5053

@@ -61,15 +64,15 @@ on:
6164

6265
Below is an example workflow that has been setup to run every time a new version is created on git.
6366

64-
This workflow sets up the environment on Windows, Ubuntu, and macOS latest versions. Note under `jobs.release.strategy.matrix` the platform array which contains `macos-latest`, `ubuntu-latest`, and `windows-latest`.
67+
This workflow sets up the environment on Windows, Ubuntu, and macOS latest versions. Note under `jobs.release.strategy.matrix` the platform array which contains `macos-latest`, `ubuntu-20.04`, and `windows-latest`.
6568

6669
The steps this workflow takes are:
6770

68-
1. Checkout the repository using `actions/checkout@v2`
69-
2. Set up Node 16 using `actions/setup-node@v1`
70-
3. Set up Rust using `actions-rs/toolchain@v1`
71-
4. Installs all the dependencies and run the build script (for the web app)
72-
5. Finally, it uses `tauri-apps/tauri-action@v0` to run `tauri build`, generate the artifacts, and create the GitHub release
71+
1. Checkout the repository using `actions/checkout@v3`
72+
2. Set up Node LTS and a cache for global npm/yarn/pnpm package data using `actions/setup-node@v3`.
73+
3. Set up Rust and a cache for the `target/` folder using `dtolnay/rust-toolchain@stable` and `swatinem/rust-cache@v2`.
74+
4. Installs all the dependencies and run the build script (for the web app).
75+
5. Finally, it uses `tauri-apps/tauri-action@v0` to run `tauri build`, generate the artifacts, and create the GitHub release.
7376

7477
```yaml
7578
name: Release
@@ -84,51 +87,46 @@ jobs:
8487
strategy:
8588
fail-fast: false
8689
matrix:
87-
platform: [macos-latest, ubuntu-latest, windows-latest]
90+
platform: [macos-latest, ubuntu-20.04, windows-latest]
8891
runs-on: ${{ matrix.platform }}
8992
steps:
9093
- name: Checkout repository
91-
uses: actions/checkout@v2
92-
93-
- name: Node.js setup
94-
uses: actions/setup-node@v1
95-
with:
96-
node-version: 16
97-
98-
- name: Rust setup
99-
uses: actions-rs/toolchain@v1
100-
with:
101-
toolchain: stable
94+
uses: actions/checkout@v3
10295
10396
- name: Install dependencies (ubuntu only)
104-
if: matrix.platform == 'ubuntu-latest'
97+
if: matrix.platform == 'ubuntu-20.04'
98+
# You can remove libayatana-appindicator3-dev if you don't use the system tray feature.
10599
run: |
106100
sudo apt-get update
107-
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
108-
101+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
102+
103+
- name: Rust setup
104+
uses: dtolnay/rust-toolchain@stable
105+
109106
- name: Rust cache
110107
uses: swatinem/rust-cache@v2
111108
with:
112-
workspaces: "./src-tauri -> target"
109+
workspaces: './src-tauri -> target'
113110
114111
- name: Sync node version and setup cache
115112
uses: actions/setup-node@v3
116113
with:
117114
node-version: 'lts/*'
118115
cache: 'yarn' # Set this to npm, yarn or pnpm.
119-
116+
120117
- name: Install app dependencies and build web
121-
run: yarn && yarn build
118+
# Remove `&& yarn build` if you build your frontend in `beforeBuildCommand`
119+
run: yarn && yarn build # Change this to npm, yarn or pnpm.
122120

123121
- name: Build the app
124122
uses: tauri-apps/tauri-action@v0
125123

126124
env:
127125
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128126
with:
129-
tagName: v__VERSION__ # tauri-action replaces \_\_VERSION\_\_ with the app version
130-
releaseName: 'v__VERSION__'
131-
releaseBody: 'See the assets to download this version and install.'
127+
tagName: ${{ github.ref_name }} # This only works if your workflow triggers on new tags.
128+
releaseName: 'App Name v__VERSION__' # tauri-action replaces \_\_VERSION\_\_ with the app version.
129+
releaseBody: 'See the assets to download and install this version.'
132130
releaseDraft: true
133131
prerelease: false
134132
```

0 commit comments

Comments
 (0)