-
-
Notifications
You must be signed in to change notification settings - Fork 38
140 lines (122 loc) · 4.2 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
name: Android CI
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
jobs:
test:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('**.gradle', '**/**.gradle', '**/gradle/wrapper/gradle-wrapper.properties') }}
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Unit tests
run: bash ./gradlew testDebug --stacktrace
lint:
name: Run lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('**.gradle', '**/**.gradle', '**/gradle/wrapper/gradle-wrapper.properties') }}
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Lint
run: bash ./gradlew lintVitalRelease
build:
name: Generate apk
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('**.gradle', '**/**.gradle', '**/gradle/wrapper/gradle-wrapper.properties') }}
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build debug apk
run: bash ./gradlew :app:assembleDebug
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: debug apk
path: ${{ github.workspace }}/app/build/outputs/apk/debug/*.apk
- name: Update debug tag
if: (github.event_name == 'push' && github.ref == 'refs/heads/develop')
uses: richardsimko/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: debug
- name: Update debug release
if: (github.event_name == 'push' && github.ref == 'refs/heads/develop')
uses: ncipollo/[email protected]
with:
tag: debug
name: Debug APK
artifacts: ${{ github.workspace }}/app/build/outputs/apk/debug/DankChat-debug.apk
allowUpdates: true
build-release:
name: Generate signed release apk
runs-on: ubuntu-latest
environment: release
if: (github.event_name == 'push' && github.ref == 'refs/heads/develop')
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('**.gradle', '**/**.gradle', '**/gradle/wrapper/gradle-wrapper.properties') }}
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Decode Keystore
id: decode_keystore
uses: timheuer/[email protected]
with:
fileName: '/app/keystore/DankChat.jks'
fileDir: ${{ github.workspace }}
encodedString: ${{ secrets.SIGNING_KEY }}
- name: Build signed release apk
run: bash ./gradlew app:assembleRelease
env:
SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: Signed release apk
path: ${{ github.workspace }}/app/build/outputs/apk/release/*.apk
- name: Update release tag
uses: richardsimko/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release
- name: Update signed release
uses: ncipollo/[email protected]
with:
tag: release
name: Signed release APK
artifacts: ${{ github.workspace }}/app/build/outputs/apk/release/*.apk
allowUpdates: true