-
Notifications
You must be signed in to change notification settings - Fork 106
150 lines (128 loc) · 4.21 KB
/
android_release.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
name: Android release
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
jobs:
unit_tests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Unit tests
run: ./gradlew testDebugUnitTest
- name: Generate code coverage
run: ./gradlew shared:koverXmlReportDebug
- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: code-coverage.xml
path: shared/build/coverage-report/result.xml
build:
needs: unit_tests
runs-on: macos-latest
strategy:
matrix:
format: [
{ type: "apk", command: "assembleRelease", output: "apk" },
{
type: "aab",
command: "generateReleaseBaseline
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile
-Pandroid.testoptions.manageddevices.emulator.gpu=\"swiftshader_indirect\"
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
-Pandroid.experimental.androidTest.numManagedDeviceShards=1
-Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1
bundleRelease",
output: "bundle"
}
]
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Clean GMD
run: ./gradlew cleanManagedDevices --unused-only
- name: Decode Keystore
env:
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE_ENCODED }}
run: |
echo $ENCODED_KEYSTORE > keystore-b64.txt
base64 -d -i keystore-b64.txt > ./androidApp/keystore.jks
- name: Build release
env:
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
KEYSTORE_PATH: keystore.jks
run: ./gradlew ${{ matrix.format.command }}
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: app-release.${{ matrix.format.type }}
path: androidApp/build/outputs/${{ matrix.format.output }}/release/*.${{ matrix.format.type }}
- name: Upload mapping folder
uses: actions/upload-artifact@v4
with:
name: mapping-${{ matrix.format.type }}
path: androidApp/build/outputs/mapping/
release:
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Tag Release
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}
- name: Download APK
uses: actions/download-artifact@v4
with:
name: app-release.apk
- name: Download APK mapping
uses: actions/download-artifact@v4
with:
name: mapping-apk
path: mapping-apk
- name: Zip APK mapping
run: |
zip -r mapping-apk.zip mapping-apk/
- name: Download AAB
uses: actions/download-artifact@v4
with:
name: app-release.aab
- name: Download AAB mapping
uses: actions/download-artifact@v4
with:
name: mapping-aab
path: mapping-aab
- name: Zip AAB mapping
run: |
zip -r mapping-aab.zip mapping-aab/
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "*.apk,*.aab,mapping-apk.zip,mapping-aab.zip"
draft: true
name: ${{ github.event.inputs.version }}
tag: ${{ github.event.inputs.version }}