-
Notifications
You must be signed in to change notification settings - Fork 88
114 lines (99 loc) · 3.5 KB
/
android-build-verify.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
name: PR - Android build verification
env:
backendServiceDefaultUrl: https://api.sandbox.mosip.net
on:
push:
branches:
- main
- develop
- demobranch
- qa-develop
- 0.9
tags:
- '*'
pull_request:
types: [ opened, synchronize ]
branches:
- develop
- 'release-**'
tags:
- '*'
jobs:
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Cache local npm repository
uses: actions/[email protected]
with:
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
path: ~/.npm
- name: Cache local gradle repository
uses: actions/[email protected]
with:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
path: |
~/.gradle/caches
~/.gradle/wrapper
- name: Install npm dependencies
run: |
npm ci
- name: Create .env.local file
run: |
echo "${{ secrets.ENV_FILE }}" > .env.local > android/local.properties
- name: Setup branch and env
run: |
# Strip git ref prefix from version
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV
- name: Setup branch and GPG public key
run: |
# Strip git ref prefix from version
echo ${{ env.BRANCH_NAME }}
echo ${{ env.GPG_TTY }}
sudo apt-get --yes install gnupg2
gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg
gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg
- name: Setup Firebase
run: |
cd android
if [ ! -z "$FIREBASE_SECRET" ] && [ -f app/google-services.json.gpg ];then rm -f app/google-services.json;gpg2 --quiet --batch --passphrase=$FIREBASE_SECRET --pinentry-mode loopback --decrypt --output app/google-services.json app/mosip-google-services.json.gpg;fi
env:
FIREBASE_SECRET: ${{ secrets.GPG_SECRET }}
- name: Generate keystore
run: |
keytool \
-genkey -v \
-storetype PKCS12 \
-keyalg RSA \
-keysize 2048 \
-validity 10000 \
-storepass $DEBUG_KEYSTORE_PASSWORD \
-keypass $DEBUG_KEYSTORE_PASSWORD \
-alias androiddebugkey \
-keystore android/app/debug.keystore \
-dname "CN=io.mosip.residentapp,OU=,O=,L=,S=,C=US"
env:
DEBUG_KEYSTORE_PASSWORD: '${{secrets.INJI_ANDROID_DEBUG_STOREPASS}}'
- name: Export variables for keystore
run: |
cd android/app
export DEBUG_KEYSTORE_ALIAS=androiddebugkey
export DEBUG_KEYSTORE_PASSWORD=$DEBUG_KEYSTORE_PASSWORD
env:
DEBUG_KEYSTORE_PASSWORD: '${{secrets.INJI_ANDROID_DEBUG_STOREPASS}}'
- name: Bump version code
uses: chkfung/[email protected]
with:
gradlePath: android/app/build.gradle
versionCode: ${{github.run_number}}
- name: Run Build using Fastlane
run: |
cd android/scripts
./verify-build.sh
env:
DEBUG_KEYSTORE_ALIAS: androiddebugkey
DEBUG_KEYSTORE_PASSWORD: '${{secrets.INJI_ANDROID_DEBUG_STOREPASS}}'