-
Notifications
You must be signed in to change notification settings - Fork 0
202 lines (177 loc) · 9.26 KB
/
android_cd.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
name: Android CD
on:
push:
branches: [main, qa]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Cache Gradle packages
uses: actions/[email protected]
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Access APP_GOOGLE_SERVICES_JSON
run: echo '${{ secrets.APP_GOOGLE_SERVICES_JSON }}' > ./app/google-services.json
- name: Access DATA_GOOGLE_SERVICES_JSON
run: echo '${{ secrets.DATA_GOOGLE_SERVICES_JSON }}' > ./data/google-services.json
- name: Add Key Info into local.properties
run: |
touch ./local.properties
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }}
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
REGION_CODE_SERVICE_KEY: ${{ secrets.REGION_CODE_SERVICE_KEY }}
APP_EMAIL_ID: ${{ secrets.APP_EMAIL_ID }}
APP_EMAIL_PASSWORD: ${{ secrets.APP_EMAIL_PASSWORD }}
CEO_EMAIL: ${{ secrets.CEO_EMAIL }}
- name: Build with Gradle Without Test
run: ./gradlew build -x test
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Access APP_GOOGLE_SERVICES_JSON
run: echo '${{ secrets.APP_GOOGLE_SERVICES_JSON }}' > ./app/google-services.json
- name: Access DATA_GOOGLE_SERVICES_JSON
run: echo '${{ secrets.DATA_GOOGLE_SERVICES_JSON }}' > ./data/google-services.json
- name: Add Key Info into local.properties
run: |
touch ./local.properties
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }}
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
REGION_CODE_SERVICE_KEY: ${{ secrets.REGION_CODE_SERVICE_KEY }}
APP_EMAIL_ID: ${{ secrets.APP_EMAIL_ID }}
APP_EMAIL_PASSWORD: ${{ secrets.APP_EMAIL_PASSWORD }}
CEO_EMAIL: ${{ secrets.CEO_EMAIL }}
- name: Run unit tests
run: ./gradlew testDebugUnitTest
- name: Create android test report
uses: asadmansr/[email protected]
if: ${{ always() }}
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Cache Gradle packages
uses: actions/[email protected]
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Add Key Info into local.properties
run: |
touch ./local.properties
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }}
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
REGION_CODE_SERVICE_KEY: ${{ secrets.REGION_CODE_SERVICE_KEY }}
APP_EMAIL_ID: ${{ secrets.APP_EMAIL_ID }}
APP_EMAIL_PASSWORD: ${{ secrets.APP_EMAIL_PASSWORD }}
CEO_EMAIL: ${{ secrets.CEO_EMAIL }}
- name: Access APP_GOOGLE_SERVICES_JSON
run: echo '${{ secrets.APP_GOOGLE_SERVICES_JSON }}' > ./app/google-services.json
- name: Access DATA_GOOGLE_SERVICES_JSON
run: echo '${{ secrets.DATA_GOOGLE_SERVICES_JSON }}' > ./data/google-services.json
- name: Gradel Release Build
run: ./gradlew assembleRelease
- name: Sign APK
id: sign_apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.KEY_BASE_64_RELEASE }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
# override default build-tools version (33.0.0) -- optional
BUILD_TOOLS_VERSION: "34.0.0"
- name: Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{secrets.FIREBASE_APP_ID}}
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
groups: android-developer, tht-team
file: app/build/outputs/apk/release/app-release-unsigned-signed.apk
releaseNotesFile: app/release_note.md
alert:
runs-on: ubuntu-latest
needs: [build, release, test]
steps:
- name: action-slack
uses: 8398a7/[email protected]
with:
status: ${{ job.status }}
author_name: THT-Android CI
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
custom_payload: |
{
attachments: [{
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
text: `${process.env.AS_WORKFLOW}\n${process.env.AS_JOB} (${process.env.AS_COMMIT}) of ${process.env.AS_REPO}@${process.env.AS_REF} by ${process.env.AS_AUTHOR} ${{ job.status }} in ${process.env.AS_TOOK}`,
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: always() # Pick up events even if the job fails or is canceled.