-
-
Notifications
You must be signed in to change notification settings - Fork 1
190 lines (166 loc) · 6.11 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: 'test'
on:
- push
jobs:
test-tauri:
name: Test ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
type: 'desktop'
args: '--target aarch64-apple-darwin'
targetPath: '/aarch64-apple-darwin'
name: 'macos-aarch64'
rust-targets: 'aarch64-apple-darwin'
- platform: 'macos-latest'
type: 'desktop'
args: '--target x86_64-apple-darwin'
targetPath: '/x86_64-apple-darwin'
name: 'macos-x86_64'
rust-targets: 'x86_64-apple-darwin'
- platform: 'ubuntu-24.04'
type: 'desktop'
args: ''
targetPath: ''
name: 'linux'
rust-targets: ''
- platform: 'windows-latest'
type: 'desktop'
args: ''
targetPath: ''
name: 'windows'
rust-targets: ''
- platform: 'ubuntu-24.04'
type: 'android'
args: ''
targetPath: ''
name: 'android'
rust-targets: 'aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android'
runs-on: ${{ matrix.platform }}
steps:
- name: 'Shared: Checkout'
uses: actions/checkout@v4
- name: 'Shared: Set up nasm'
uses: ilammy/setup-nasm@v1
- name: 'Shared: Setup node'
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: 'Shared: Install pnpm'
uses: pnpm/action-setup@v4
with:
version: 9
- name: 'Shared: Install Rust toolchain'
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.rust-targets }}
- name: 'Desktop: Cache dependencies'
if: matrix.type == 'desktop'
uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ matrix.name }}
workspaces: src-tauri
cache-on-failure: true
cache-all-crates: true
- name: 'Ubuntu: Install linux dependencies'
if: matrix.name == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: 'Shared: Install frontend dependencies'
run: pnpm install
- name: 'Windows: Install SignPath command'
if: matrix.name == 'windows'
shell: powershell
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module -scope CurrentUser -Force -Name SignPath
- name: 'Desktop: Build tauri project'
if: matrix.type == 'desktop'
uses: tauri-apps/tauri-action@v0
env:
SIGNPATH_POLICY_SLUG: test-signing
SIGNPATH_API_KEY: ${{ secrets.SIGNPATH_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
includeDebug: true
includeRelease: false
args: ${{ matrix.args }}
- name: 'Desktop: Upload artifact'
if: matrix.type == 'desktop'
uses: actions/upload-artifact@v4
with:
name: tauri-artifact-${{ matrix.name }}
path: |
./src-tauri/target${{ matrix.targetPath }}/debug/bundle/dmg/*.dmg
./src-tauri/target${{ matrix.targetPath }}/debug/bundle/nsis/*.exe
./src-tauri/target${{ matrix.targetPath }}/debug/bundle/appimage/*.AppImage
./src-tauri/target${{ matrix.targetPath }}/debug/bundle/deb/*.deb
./src-tauri/target${{ matrix.targetPath }}/debug/bundle/rpm/*.rpm
./src-tauri/target${{ matrix.targetPath }}/debug/bundle/macos/*.app
if-no-files-found: error
###########
# Android #
###########
- name: 'Android: Install dependencies'
if: matrix.type == 'android'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake golang-go libunwind-dev
- name: 'Android: Set up JDK 21'
if: matrix.type == 'android'
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: 'Android: Setup Android SDK'
if: matrix.type == 'android'
uses: android-actions/setup-android@v3
- name: 'Android: Set up NDK'
if: matrix.type == 'android'
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r26d
link-to-sdk: false
add-to-path: false
- name: 'Android: Install tauri cli'
if: matrix.type == 'android'
run: |
cargo install --debug --force --locked tauri-cli
cargo install --debug --force --locked bindgen-cli
- name: 'Android: Decode JKS file'
if: matrix.type == 'android'
run: |
echo "${{ secrets.TAURI_ANDROID_KEYSTORE_FILE }}" | base64 --decode > /tmp/keystore.jks
- name: 'Android: Configure android build'
if: matrix.type == 'android'
run: |
cat <<EOF > src-tauri/gen/android/keystore.properties
password=${{ secrets.TAURI_ANDROID_KEYSTORE_PASSWORD }}
keyAlias=upload
storeFile=/tmp/keystore.jks
EOF
- name: 'Android: Build android project'
if: matrix.type == 'android'
run: |
export ANDROID_SDK_HOME=$ANDROID_HOME
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
export ANDROID_NDK=$NDK_HOME
export ANDROID_NDK_HOME=$NDK_HOME
export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
cargo tauri android build
env:
NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: 'Android: Upload artifact'
if: matrix.type == 'android'
uses: actions/upload-artifact@v4
with:
name: tauri-artifact-${{ matrix.name }}
path: './src-tauri/gen/android/app/build/outputs'
if-no-files-found: error