-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (109 loc) · 3.9 KB
/
tauri.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
name: Tauri
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
platform: [windows, android]
steps:
- uses: actions/checkout@v4
- 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
shell: powershell
- name: Verify bun installation
run: bun --version
- name: Install dependencies
run: bun install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Rust Android Target
if: matrix.platform == 'android'
run: rustup target add aarch64-linux-android
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Install Android SDK
if: matrix.platform == 'android'
uses: android-actions/setup-android@v2
with:
api-level: 21
ndk-version: 26.3.11579264
- name: Set up NDK_HOME environment variable
if: matrix.platform == 'android'
run: echo "NDK_HOME=$env:ANDROID_SDK_ROOT/ndk/26.3.11579264" >> $env:GITHUB_ENV
- name: Add Android SDK to PATH
if: matrix.platform == 'android'
run: echo "$env:ANDROID_SDK_ROOT/cmdline-tools/latest/bin" >> $env:GITHUB_PATH
- name: Install Android dependencies
if: matrix.platform == 'android'
run: sdkmanager "platforms;android-21" "build-tools;30.0.3" "ndk;26.3.11579264"
- name: Build for Windows
if: matrix.platform == 'windows'
run: |
bun tauri build --verbose
- name: Build Android APK
if: matrix.platform == 'android'
run: |
bun tauri android build --verbose
shell: pwsh
- name: Extract version from package.json
id: extract_version
run: |
$packageJson = Get-Content -Raw -Path package.json | ConvertFrom-Json
$version = $packageJson.version
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
shell: pwsh
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
draft: false
prerelease: false
- name: Upload MSI Asset
if: matrix.platform == 'windows'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/xyyinfoquery_${{ env.VERSION }}_x64_en-US.msi
asset_name: xyyinfoquery_${{ env.VERSION }}_x64_en-US.msi
asset_content_type: application/octet-stream
- name: Upload EXE Asset
if: matrix.platform == 'windows'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/xyyinfoquery_${{ env.VERSION }}_x64-setup.exe
asset_name: xyyinfoquery_${{ env.VERSION }}_x64-setup.exe
asset_content_type: application/octet-stream
- name: Upload APK Asset
if: matrix.platform == 'android'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: src-tauri/target/android/release/app-release.apk
asset_name: xyyinfoquery_${{ env.VERSION }}_android.apk
asset_content_type: application/vnd.android.package-archive