-
Notifications
You must be signed in to change notification settings - Fork 71
87 lines (74 loc) · 3.12 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
name: Android Build ## name of the workflow
on:
workflow_dispatch:
push:
pull_request:
jobs:
android-build:
if: ${{ github.ref_name != 'main' }}
name: Android Build
runs-on: ubuntu-latest # using ubuntu latest version / or you can use a specific version
steps:
- name: Check out Git repository # clone the repo to local ci workspace
uses: actions/checkout@v3
- name: Set up our JDK environment # setup JDK environment: mandatory as we need to build android project
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 8
- name: Set up our Node version
uses: actions/setup-node@v3
with:
node-version: 16.14
- name: Install dependencies
run: npm ci
# configure cash for gradle : will help to reduce build time
- name: Cache Gradle Wrapper
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle Dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- name: Make Gradlew Executable
run: cd android && chmod +x ./gradlew
- name: Generate App APK
run: |
npm run build:release
env:
APP_CENTER_SECRET: ${{ secrets.APP_CENTER_SECRET }}
CODE_PUSH_DEPLOYMENT_KEY: ${{ secrets.CODE_PUSH_DEPLOYMENT_KEY }}
NODE_ENV: ${{ secrets.NODE_ENV }}
## sign generated apk
- name: Sign APK
id: sign_app
uses: iota9star/[email protected]
with:
releaseDirectory: android/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.MYAPP_UPLOAD_STORE_FILE_BASE64 }}
alias: ${{ secrets.MYAPP_UPLOAD_KEY_ALIAS }}
keyStorePassword: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }}
keyPassword: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }}
fileRegex: .*apk
- name: Upload artifact to App Center
uses: wzieba/AppCenter-Github-Action@v1
with:
appName: xianshenglu/cloudflare-ip-tester-app
token: ${{secrets.APP_CENTER_TOKEN}}
group: Collaborators
file: android/app/build/outputs/apk/release/app-universal-release-signed.apk
notifyTesters: true
debug: false
- name: test
id: test
run: |
echo "${{ github.workspace }}/${{ fromJson(steps.sign_app.outputs.signedReleaseFiles)[0] }}"
echo "${{ github.workspace }}/${{ fromJson(steps.sign_app.outputs.signedReleaseFiles)[1] }}"
echo "${{ github.workspace }}/${{ fromJson(steps.sign_app.outputs.signedReleaseFiles)[2] }}"
echo "${{ github.workspace }}/${{ fromJson(steps.sign_app.outputs.signedReleaseFiles)[3] }}"
echo "${{ github.workspace }}/${{ fromJson(steps.sign_app.outputs.signedReleaseFiles)[4] }}"