-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (101 loc) · 3.65 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
name: Android CI
on:
push:
branches: [ "github-action" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
#
# - name: Run a one-line script
# run: echo Hello, world!
#
# - name: Run a multi-line script
# run: |
# echo Add other actions to build,
# echo test, and deploy your project.
- name: Cache Gradle packages
uses: actions/cache@v2
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 DEV_BASE_URL
run: |
echo DEV_BASE_URL=\"DEV_BASE_URL\" > local.properties
echo PROD_BASE_URL=\"PROD_BASE_URL\" >> local.properties
echo key_alias=\"key_alias\" >> local.properties
echo key_password=\"key_password\" >> local.properties
echo store_password=\"store_password\" >> local.properties
shell: bash
env:
DEV_BASE_URL: ${{ secrets.DEV_BASE_URL }}
PROD_BASE_URL: ${{ secrets.PROD_BASE_URL }}
key_alias: ${{ secrets.ALIAS }}
key_password: ${{ secrets.KEY_PASSWORD }}
store_password: ${{ secrets.KEY_STORE_PASSWORD }}
- name: Load Google Service file
run: echo $DATA | base64 -di > app/google-services.json
env:
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
- name: Build clean
run: ./gradlew clean
# - name: Run ktlint
# run: ./gradlew ktlintCheck
#
# - name: Run detekt
# run: ./gradlew detekt
- name: Build assemble debug apk
run: ./gradlew assembleDebug --stacktrace
- name: Build assemble release apk
run: ./gradlew assembleRelease --stacktrace
- name: Upload Debug APK
uses: actions/upload-artifact@v3
with:
name: debug
path: ./app/build/outputs/apk/debug/app-debug.apk
- name: Signing Release APK
uses: r0adkll/sign-android-release@v1
# ID used to access action output
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
# override default build-tools version (33.0.0) -- optional
BUILD_TOOLS_VERSION: "34.0.0"
# Example use of `signedReleaseFile` output -- not needed
- uses: actions/upload-artifact@v3
with:
name: Signed app bundle
path: ${{steps.sign_app.outputs.signedReleaseFile}}
# - name: Upload Release APK
# uses: actions/upload-artifact@v3
# with:
# name: release
# path: ./app/build/outputs/apk/release/app-release.apk
#
# - name: Upload apk to Firebase App Distribution
# uses: wzieba/Firebase-Distribution-Github-Action@v1
# with:
# appId: ${{ secrets.FIREBASE_APP_ID }}
# serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
# groups: testers
# file: app/build/outputs/apk/release/app-release-unsigned.apk