forked from ArtifexSoftware/mupdf-android-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (54 loc) · 2.35 KB
/
android.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
name: Android CI
on:
workflow_dispatch:
inputs:
docker_images:
description: '请填写docker镜像名称 多个用英文逗号分开'
required: true
default: 'alpine:latest' # 设置默认的 Docker 镜像列表
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Install Android SDK & Build Tools
run: |
sudo apt-get update
sudo apt-get install -y wget unzip
wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip
unzip commandlinetools-linux-7583922_latest.zip -d cmdline-tools
sudo mv cmdline-tools /usr/local/android-sdk
echo "export ANDROID_SDK_ROOT=/usr/local/android-sdk" >> $GITHUB_ENV
echo "export PATH=\$PATH:/usr/local/android-sdk/cmdline-tools/bin" >> $GITHUB_ENV
# Accept licenses
yes | sdkmanager --licenses
# Install build tools (includes zipalign)
sdkmanager "build-tools;30.0.3"
# Add build tools path to environment
echo "export PATH=\$PATH:/usr/local/android-sdk/build-tools/30.0.3" >> $GITHUB_ENV
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assembleRelease
# Step 6: Generate Keystore using keytool
- name: Generate Keystore
run: |
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 \
-alias my-key-alias -storepass android -keypass android \
-dname "CN=Example, OU=Dev, O=MyCompany, L=City, ST=State, C=US"
# Step 7: Sign APK
- name: Sign APK
run: |
jarsigner -verbose -keystore my-release-key.jks -storepass android -keypass android \
app/build/outputs/apk/release/app-arm64-v8a-release-unsigned.apk my-key-alias
zipalign -v 4 app/build/outputs/apk/release/app-arm64-v8a-release-unsigned.apk app/build/outputs/apk/release/app-release.apk
- uses: actions/upload-artifact@v4
with:
name: build-artifact
path: app/build/outputs/apk/release/app-release.apk