-
Notifications
You must be signed in to change notification settings - Fork 3
162 lines (138 loc) · 5.03 KB
/
main.yaml
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
name: 'release'
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest' # for Arm based macs (M1 and above).
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest' # for Intel based macs.
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04'
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Setup Bun
uses: oven-sh/setup-bun@v1
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Install frontend dependencies
run: bun install
- uses: tauri-apps/tauri-action@v0
id: tauri
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: app-v__VERSION__
releaseName: 'App v__VERSION__'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
build-android:
runs-on: ubuntu-latest
needs: publish-tauri
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
- name: Setup Bun
uses: oven-sh/setup-bun@v1
- name: Install frontend dependencies
run: bun install
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install NDK
run: sdkmanager "ndk;27.0.11902837"
- name: setup Android signing
run: |
cd src-tauri/gen/android
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" > keystore.properties
echo "password=${{ secrets.ANDROID_KEY_PASSWORD }}" >> keystore.properties
base64 -d <<< "${{ secrets.ANDROID_KEY_BASE64 }}" > $RUNNER_TEMP/keystore.jks
echo "storeFile=$RUNNER_TEMP/keystore.jks" >> keystore.properties
- name: Build app bundle
id: build
run: |
bun tauri android build --apk
apk_path="src-tauri/gen/android/app/build/outputs/apk/universal/release/"
echo apk_path=$apk_path >> $GITHUB_ENV
env:
NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.0.11902837
- name: Verify APK signing
run: |
apk_path="${{ steps.build.outputs.apk_path }}"
for apk in $apk_path/*.apk; do
echo "Verifying $apk..."
if jarsigner -verify -certs "$apk"; then
echo "Verification PASSED for $apk"
else
echo "Verification FAILED for $apk"
fi
done
- name: Align the Universal APK (optional but recommended)
run: |
apk_path="${{ steps.build.outputs.apk_path }}"
zipalign_path="${ANDROID_HOME}/build-tools/30.0.3/zipalign"
for apk in $apk_path/*.apk; do
$zipalign_path -v 4 "$apk" "$apk"
done
- name: Rename APKs
run: |
apk_path="${{ steps.build.outputs.apk_path }}"
version_name=$(grep versionName build.gradle.kts | sed 's/.*versionName = "\(.*\)"/\1/')
for apk in $apk_path/*.apk; do
abi=$(basename "$apk" | sed 's/app-universal-\(.*\)-release.apk/\1/')
new_name="biliresourcedownloader_${version_name}_android_${abi}.apk"
mv "$apk" "$apk_path/$new_name"
echo "Renamed $apk to $new_name"
done
- name: Upload APKs to release created by tauri-action
uses:
softprops/action-gh-release@v1
with:
draft: true
files: |
'src-tauri/gen/android/app/build/outputs/apk/universal/release/*.apk'
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.tauri.outputs.tag }}