-
Notifications
You must be signed in to change notification settings - Fork 7
97 lines (79 loc) · 2.74 KB
/
android-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
name: Android Build
on:
push:
tags:
- 'v*'
branches:
- test
env:
ACTIONS_RUNNER_DEBUG: true
ACTIONS_STEP_DEBUG: true
APP_NAME: "shockwallet"
VERSION: ${{ github.ref_name }}
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
- name: Install deps
run: |
npm ci
npm install -g @ionic/cli native-run cordova-res
- name: Set up environment
run: cp .env.production.example .env
- name: Run pre-build script
run: npm run prebuild
- name: Build Android app
run: ionic cap build android --no-interactive
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Cache Gradle packages
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: Make gradlew executable
run: chmod +x ./android/gradlew
- name: Build with Gradle
run: |
cd android
./gradlew assembleRelease
- name: Set up Android SDK
uses: android-actions/setup-android@v3
- name: Decode Keystore
run: |
echo ${{ secrets.ANDROID_KEYSTORE }} | base64 --decode > my-release-key.keystore
shell: bash
- name: Verify Keystore
run: |
keytool -list -v -keystore my-release-key.keystore -storepass ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
shell: bash
- name: Sign APK
run: |
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore -storepass ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} -keypass ${{ secrets.ANDROID_KEY_PASSWORD }} android/app/build/outputs/apk/release/app-release-unsigned.apk ${{ secrets.ANDROID_KEY_ALIAS }}
zipalign -v 4 android/app/build/outputs/apk/release/app-release-unsigned.apk android/app/build/outputs/apk/release/${{ env.APP_NAME }}-${{ env.VERSION }}.apk
shell: bash
- name: Verify APK
run: |
apksigner verify android/app/build/outputs/apk/release/${{ env.APP_NAME }}-${{ env.VERSION }}.apk
shell: bash
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: app-release
path: android/app/build/outputs/apk/release/${{ env.APP_NAME }}-${{ env.VERSION }}.apk