-
Notifications
You must be signed in to change notification settings - Fork 5
140 lines (116 loc) · 3.71 KB
/
Copy pathci.yml
File metadata and controls
140 lines (116 loc) · 3.71 KB
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: CI
on:
push:
branches: [main, master]
tags: ['v*']
pull_request:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
pr-checks:
name: PR checks (test + lint + debug APK)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Run unit tests
run: ./gradlew :app:testDebugUnitTest
- name: Run lint
run: ./gradlew :app:lintDebug
- name: Build debug APK
run: ./gradlew :app:assembleDebug
- name: Build user-cert debug APK
run: ./gradlew :app:assembleDebugUserCert
- name: Upload debug APK
uses: actions/upload-artifact@v4
with:
name: app-debug
path: app/build/outputs/apk/debug/*.apk
if-no-files-found: warn
retention-days: 14
- name: Upload user-cert debug APK
uses: actions/upload-artifact@v4
with:
name: app-debug-user-cert
path: app/build/outputs/apk/debugUserCert/export/*.apk
if-no-files-found: warn
retention-days: 14
- name: Upload lint report
if: failure()
uses: actions/upload-artifact@v4
with:
name: lint-report
path: app/build/reports/lint-results-debug.html
if-no-files-found: warn
retention-days: 14
release:
name: Release APK
runs-on: ubuntu-latest
needs: pr-checks
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Decode release keystore
env:
KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
run: |
mkdir -p signing
echo "$KEYSTORE_BASE64" | base64 -d > signing/linecode-release.keystore
ls -la signing
- name: Write signing.properties
env:
STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
run: |
{
printf 'storeFile=%s/signing/linecode-release.keystore\n' "$GITHUB_WORKSPACE"
printf 'storePassword=%s\n' "$STORE_PASSWORD"
printf 'keyAlias=%s\n' "$KEY_ALIAS"
printf 'keyPassword=%s\n' "$KEY_PASSWORD"
} > signing.properties
cat signing.properties
- name: Validate signing config
run: ./gradlew :app:validateReleaseSigning
- name: Build release APK
run: ./gradlew :app:assembleRelease
- name: Upload release APK
uses: actions/upload-artifact@v4
with:
name: app-release
path: app/release/*.APK
if-no-files-found: warn
retention-days: 90
- name: Upload release APK signature
uses: actions/upload-artifact@v4
with:
name: app-release-idsig
path: app/release/*.idsig
if-no-files-found: warn
retention-days: 90