-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (112 loc) · 4.61 KB
/
tauri ci.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
name: Tauri CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache bun dependencies
uses: actions/cache@v3
with:
path: ~/.bun
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install bun
run: powershell -c "irm bun.sh/install.ps1 | iex"
- name: Add bun to PATH
run: echo "C:\Users\runneradmin\.bun\bin" >> $env:GITHUB_PATH
- name: Verify bun installation
run: bun --version
- name: Install dependencies
run: bun install
- name: Cache Rust build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Cache Gradle files
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Install Rust Android Target
run: rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Install Android SDK
uses: android-actions/setup-android@v3
- name: Add Android SDK to PATH
run: echo "$env:ANDROID_SDK_ROOT/cmdline-tools/latest/bin" >> $env:GITHUB_PATH
- name: Install Android dependencies
run: sdkmanager "platforms;android-24" "build-tools;34.0.0" "ndk;26.3.11579264"
- name: Add Android build-tools to PATH
run: echo "$env:ANDROID_SDK_ROOT/build-tools/34.0.0" >> $env:GITHUB_PATH
- name: Set up NDK_HOME environment variable
run: echo "NDK_HOME=$env:ANDROID_SDK_ROOT/ndk/26.3.11579264" >> $env:GITHUB_ENV
- name: Build for Windows
run: |
bun tauri build --verbose
- name: Build Android APK
run: |
bun tauri android build --verbose
- name: Sign APK
env:
KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
shell: bash
run: |
echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > release.keystore
zipalign -v 4 src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-aligned.apk
apksigner.bat sign --ks release.keystore --ks-key-alias $KEY_ALIAS --ks-pass pass:$KEYSTORE_PASSWORD --out src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-signed.apk src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-aligned.apk
- name: Extract version from package.json
id: extract_version
run: |
$tauriconfJson = Get-Content -Raw -Path src-tauri\tauri.conf.json | ConvertFrom-Json
$version = $tauriconfJson.version
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Upload MSI Artifact
uses: actions/upload-artifact@v3
with:
name: xyyinfoquery_ci_${{ env.VERSION }}_x64_zh-CN.msi
path: src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/xyyinfoquery_${{ env.VERSION }}_x64_zh-CN.msi
- name: Upload EXE Artifact
uses: actions/upload-artifact@v3
with:
name: xyyinfoquery_ci_${{ env.VERSION }}_x64-setup.exe
path: src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/xyyinfoquery_${{ env.VERSION }}_x64-setup.exe
- name: Upload APK Artifact
uses: actions/upload-artifact@v3
with:
name: xyyinfoquery_ci_${{ env.VERSION }}_universal.apk
path: src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-signed.apk