-
Notifications
You must be signed in to change notification settings - Fork 3
191 lines (162 loc) · 5.75 KB
/
android.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
name: Android CI
on:
push:
branches:
- "develop-AN"
- "feature/414-android-cd"
paths:
- '**'
pull_request:
branches:
- "develop-AN"
paths:
- 'android/**'
defaults:
run:
working-directory: ./android
jobs:
ktlint_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Create google-services
run: echo "${{ secrets.GOOGLE_SERVICES_JSON }}" > ./app/google-services.json
- name: Create local.properties
env:
BASE_URL: ${{ secrets.BASE_URL }}
TOKEN: ${{ secrets.TOKEN }}
NATIVE_APP_KEY: ${{ secrets.NATIVE_APP_KEY }}
run: |
echo "sdk.dir=/Users/chaehyun/Library/Android/sdk" > ./local.properties
echo "base_url=$BASE_URL" >> ./local.properties
echo "token=$TOKEN" >> ./local.properties
echo "native_app_key=$NATIVE_APP_KEY" >> ./local.properties
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Ktlint check
run: ./gradlew ktlintCheck
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Create google-services.json
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo "$GOOGLE_SERVICES_JSON" > app/google-services.json
- name: Create local.properties
env:
BASE_URL: ${{ secrets.BASE_URL }}
TOKEN: ${{ secrets.TOKEN }}
NATIVE_APP_KEY: ${{ secrets.NATIVE_APP_KEY }}
run: |
echo "sdk.dir=/Users/chaehyun/Library/Android/sdk" > ./local.properties
echo "base_url=$BASE_URL" >> ./local.properties
echo "token=$TOKEN" >> ./local.properties
echo "native_app_key=$NATIVE_APP_KEY" >> ./local.properties
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Gradle Clean check
run: ./gradlew clean
- name: Build with Gradle
run: ./gradlew build
- name: Run Unit Test
run: ./gradlew test
deploy:
runs-on: ubuntu-latest
# needs: build_and_test
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Create google-services.json
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: |
echo "$GOOGLE_SERVICES_JSON" > app/google-services.json
- name: Create service_account.json
id: createServiceAccount
run: echo '${{ secrets.SERVICE_ACCOUNT_KEY }}' > app/service_account.json
- name: Set up environment variable for BuildConfig
env:
BASE_URL: ${{ secrets.BASE_URL }}
TOKEN: ${{ secrets.TOKEN }}
NATIVE_APP_KEY: ${{ secrets.NATIVE_APP_KEY }}
run: |
echo "base_url=$BASE_URL" >> ./local.properties
echo "token=$TOKEN" >> ./local.properties
echo "native_app_key=$NATIVE_APP_KEY" >> ./local.properties
# - name: Cache Gradle
# uses: actions/cache@v4
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
# - name: Decode keystore
# run: |
# echo "$KEYSTORE" > KEYSTORE_NAME.b64
# base64 -d -i KEYSTORE_NAME.b64 > KEYSTORE_NAME.jks
# env:
# KEYSTORE: ${{ secrets.ENCODED_KEYSTORE }}
- name: Build release AAB
run: ./gradlew bundleRelease
- name: Sign AAB
id: sign
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: ./android/app/build/outputs/bundle/release
output: ./android/build/release/signed
signingKeyBase64: ${{ secrets.ENCODED_KEYSTORE }}
alias: ${{ secrets.AN_ALIAS }}
keyStorePassword: ${{ secrets.AN_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.AN_KEY_PASSWORD }}
- name: Upload AAB to Google Play
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: app/service_account.json
packageName: com.zzang.chongdae
releaseFiles: ./android/app/build/outputs/bundle/release/app-release.aab
track: alpha
# status: completed
# inAppUpdatePriority: 2
# userFraction: 0.33
# whatsNewDirectory: distribution/whatsnew
# mappingFile: app/build/outputs/mapping/release/mapping.txt
# debugSymbols: app/intermediates/merged_native_libs/release/out/lib