-
Notifications
You must be signed in to change notification settings - Fork 25
214 lines (200 loc) · 7.45 KB
/
android-publish.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
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Android Publish
on:
workflow_call:
inputs:
RELEASE:
description: 'Internal/Beta'
required: true
type: string
NODE_VERSION:
default: "16.x"
type: string
JAVA_VERSION:
description: "Java version for the build"
default: "11"
type: string
RELEASE_KEYSTORE_ALIAS:
default: androidreleasekey
type: string
MIMOTO_HOST:
description: "Mimoto backend service URL"
required: true
default: "https://api.sandbox.mosip.net"
type: string
ESIGNET_HOST:
description: "Esignet backend service URL"
required: true
default: "https://api.sandbox.mosip.net"
type: string
APPLICATION_THEME:
description: "Application Theme"
required: true
type: string
BUILD_DESCRIPTION:
description: "What to test"
required: true
default: "QA-Triple environment"
type: string
ALLOW_ENV_EDIT:
description: "Edit ENV"
required: true
type: string
LIVENESS_DETECTION:
description: "Detect Liveness"
required: true
type: string
ANDROID_ARTIFACT_NAME:
description: "Android Artifact name"
required: true
default: "Android App"
type: string
APP_FLAVOR:
description: 'Select App flavor'
required: true
default: 'App'
type: string
SERVICE_LOCATION:
description: "Service Location"
required: true
default: "."
type: string
ANDROID_SERVICE_LOCATION:
description: "Android Service Location"
required: true
default: "android"
type: string
BUILD_SCRIPT_LOCATION:
description: "Android build script Location"
required: true
default: "scripts"
type: string
SCRIPT_NAME:
description: "Build script name"
required: true
default: "./android-build.sh"
type: string
ANDROID_ARTIFACT_PATH:
description: "Android Artifact path"
required: true
default: "android/app/build/outputs"
type: string
secrets:
ANDROID_KEYSTORE_FILE:
required: true
RELEASE_KEYSTORE_PASSWORD:
required: true
INJI_ANDROID_PLAY_STORE_CONFIG_JSON:
required: true
SLACK_WEBHOOK_URL:
required: true
GOOGLE_ANDROID_CLIENT_ID:
required: true
jobs:
deploy-android:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: ${{ inputs.JAVA_VERSION }}
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: '~/.npm'
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Check for git tag
if: ${{ inputs.RELEASE == 'beta' }}
run: |
cd ${{ inputs.SERVICE_LOCATION }}/${{ inputs.ANDROID_SERVICE_LOCATION }}
cd ${{ inputs.BUILD_SCRIPT_LOCATION }}
./git-tag.sh
- name: Install npm dependencies
run: |
cd ${{ inputs.SERVICE_LOCATION }}
npm ci
- name: Echo branch name
run: |
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
- name: Generate keystore
run: |
echo "$ANDROID_KEYSTORE_FILE" > release.keystore.b64
base64 -d -i release.keystore.b64 > android/app/release.keystore
env:
ANDROID_KEYSTORE_FILE: ${{ secrets.ANDROID_KEYSTORE_FILE }}
- name: Create Google Play Config file
run: |
cd ${{ inputs.SERVICE_LOCATION }}/${{ inputs.ANDROID_SERVICE_LOCATION }}
echo "$INJI_ANDROID_PLAY_STORE_CONFIG_JSON" > play_config.json.b64
base64 -d -i play_config.json.b64 > play_config.json
env:
INJI_ANDROID_PLAY_STORE_CONFIG_JSON: ${{ secrets.INJI_ANDROID_PLAY_STORE_CONFIG_JSON }}
- name: Create build and upload to play console
if: ${{ inputs.RELEASE != 'beta' }}
run: |
cd ${{ inputs.SERVICE_LOCATION }}/${{ inputs.ANDROID_SERVICE_LOCATION }}
cd ${{ inputs.BUILD_SCRIPT_LOCATION }}
${{ inputs.SCRIPT_NAME }}
env:
MIMOTO_HOST: ${{ inputs.MIMOTO_HOST }}
ESIGNET_HOST: ${{ inputs.ESIGNET_HOST }}
APPLICATION_THEME: ${{ inputs.APPLICATION_THEME }}
RELEASE_KEYSTORE_ALIAS: ${{ inputs.RELEASE_KEYSTORE_ALIAS }}
RELEASE_KEYSTORE_PASSWORD: "${{secrets.RELEASE_KEYSTORE_PASSWORD}}"
CREDENTIAL_REGISTRY_EDIT: ${{ inputs.ALLOW_ENV_EDIT }}
LIVENESS_DETECTION: ${{ inputs.LIVENESS_DETECTION }}
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
BUILD_DESCRIPTION: ${{ inputs.BUILD_DESCRIPTION }}
APP_FLAVOR: ${{ inputs.APP_FLAVOR }}
GOOGLE_ANDROID_CLIENT_ID: ${{secrets.GOOGLE_ANDROID_CLIENT_ID}}
- name: Create Beta build and upload to play console
if: ${{ inputs.RELEASE == 'beta' }}
run: |
cd ${{ inputs.SERVICE_LOCATION }}/${{ inputs.ANDROID_SERVICE_LOCATION }}
cd ${{ inputs.BUILD_SCRIPT_LOCATION }}
${{ inputs.SCRIPT_NAME }}
env:
MIMOTO_HOST: ${{ inputs.MIMOTO_HOST }}
ESIGNET_HOST: ${{ inputs.ESIGNET_HOST }}
APPLICATION_THEME: ${{ inputs.APPLICATION_THEME }}
RELEASE_KEYSTORE_ALIAS: ${{ inputs.RELEASE_KEYSTORE_ALIAS }}
RELEASE_KEYSTORE_PASSWORD: "${{secrets.RELEASE_KEYSTORE_PASSWORD}}"
CREDENTIAL_REGISTRY_EDIT: ${{ inputs.ALLOW_ENV_EDIT }}
LIVENESS_DETECTION: ${{ inputs.LIVENESS_DETECTION }}
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
BUILD_DESCRIPTION: ${{ inputs.BUILD_DESCRIPTION }}
APP_FLAVOR: ${{ inputs.APP_FLAVOR }}
GOOGLE_ANDROID_CLIENT_ID: ${{secrets.GOOGLE_ANDROID_CLIENT_ID}}
- name: Create Build
run: |
npx jetify
cd ${{ inputs.SERVICE_LOCATION }}/${{ inputs.ANDROID_SERVICE_LOCATION }}
./gradlew :app:assemble${{ inputs.APP_FLAVOR }}Release
env:
MIMOTO_HOST: ${{ inputs.MIMOTO_HOST }}
ESIGNET_HOST: ${{ inputs.ESIGNET_HOST }}
APPLICATION_THEME: ${{ inputs.APPLICATION_THEME }}
RELEASE_KEYSTORE_ALIAS: ${{ inputs.RELEASE_KEYSTORE_ALIAS }}
RELEASE_KEYSTORE_PASSWORD: "${{secrets.RELEASE_KEYSTORE_PASSWORD}}"
CREDENTIAL_REGISTRY_EDIT: ${{ inputs.ALLOW_ENV_EDIT }}
LIVENESS_DETECTION: ${{ inputs.LIVENESS_DETECTION }}
GOOGLE_ANDROID_CLIENT_ID: ${{secrets.GOOGLE_ANDROID_CLIENT_ID}}
- name: Upload Artifact to Actions
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.ANDROID_ARTIFACT_NAME }}
path: ${{ inputs.ANDROID_ARTIFACT_PATH }}
retention-days: 10
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,author,commit,workflow,job # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: "${{ github.event_name != 'pull_request' && failure() }}" # Pick up events even if the job fails or is canceled.