-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (140 loc) · 4.86 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
name: Android CI
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create properties file with keys
env:
KEYS_PROPERTIES: ${{ secrets.KEYS_PROPERTIES }}
run: |
echo "$KEYS_PROPERTIES" > keys.properties
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
# Cache Gradle dependencies and Gradle Wrapper
- name: Setup Gradle Cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run Unit tests
run: ./gradlew :app:testDebugUnitTest
- name: Build debug APK
run: ./gradlew :app:assembleDebug
- name: Build androidTest APK
run: ./gradlew :app:assembleAndroidTest
- name: Run Android Tests on Firebase Test Lab (API 24)
uses: asadmansr/[email protected]
with:
arg-spec: 'android-device.yml:nexus6-api-24'
env:
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT_JSON }}
- name: Run Android Tests on Firebase Test Lab (API 33)
uses: asadmansr/[email protected]
with:
arg-spec: 'android-device.yml:pixel6-api-33'
env:
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT_JSON }}
- name: Build release APK
if: success()
run: ./gradlew :app:assembleRelease
- name: Setup build tool version variable
shell: bash
run: |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
echo Last build tool version is: $BUILD_TOOL_VERSION
- name: Sign release APK
if: success()
uses: r0adkll/sign-android-release@v1
id: sign_apk
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
- name: Build release AAB
if: success()
run: ./gradlew :app:bundleRelease
- name: Sign release AAB
if: success()
uses: r0adkll/sign-android-release@v1
id: sign_aab
with:
releaseDirectory: app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
- name: Create CHANGELOG
id: changelog
uses: oleksandrvolovik/changelog-action@v1
with:
token: ${{ secrets.GH_TOKEN }}
tag: ${{ github.ref_name }}
writeToFile: false
googlePlayMode: false
- name: Create release
if: success()
id: create_release
uses: actions/create-release@v1
with:
release_name: Release ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Upload release APK
if: success()
id: upload_release_asset
uses: actions/[email protected]
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.sign_apk.outputs.signedReleaseFile }}
asset_name: release.apk
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Create release notes for Google Play
id: release_notes
uses: oleksandrvolovik/changelog-action@v1
with:
token: ${{ secrets.GH_TOKEN }}
tag: ${{ github.ref_name }}
writeToFile: false
excludeTypes: perf,refactor,test,build,doc,style,chore,other
googlePlayMode: true
- name: Write release notes to file
env:
RELEASE_NOTES: ${{ steps.release_notes.outputs.changes }}
run: |
echo "Release notes" > whatsnew-en-US
- name: Upload release AAB to Google Play
if: success()
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: volovyk.guerrillamail
track: production
releaseFiles: ${{ steps.sign_aab.outputs.signedReleaseFile }}
whatsNewDirectory: .