-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (117 loc) · 4.67 KB
/
build-android-dev.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
name: Android Build
run-name: Android Build for ${{ inputs.brand }} on ${{github.ref_name}}
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
brand:
description: 'Brand to publish'
required: true
default: 'cozy'
type: choice
options:
- cozy
- mabulle
jobs:
android-build:
name: Android Build
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Get short SHA
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set NodeJS version
uses: actions/setup-node@v3
with:
node-version: 16
- name: Set up our JDK environment
uses: actions/setup-java@v3
with:
distribution: 'adopt-hotspot'
java-version: '11'
- name: Fixing Android Build Tool Issue
run: |
cd $ANDROID_HOME/build-tools/33.0.0
mv d8 dx
cd lib
mv d8.jar dx.jar
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Cache Gradle Wrapper
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle Dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- name: 'Create env file'
run: |
touch .env
- name: Set white label brand
run: yarn brand:configure:${{ inputs.brand }} --force
- name: Make Gradlew Executable
run: cd android && chmod +x ./gradlew
- name: Generate App APK
run: |
cd android && ./gradlew assembleRelease --no-daemon
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Clean Dev APK names and add Commit SHA
run: for f in android/app/build/outputs/apk/dev/release/*unsigned.apk; do mv "$f" "$(echo "$f" | sed s/unsigned/${{ inputs.brand }}-${{ steps.vars.outputs.sha_short }}/)"; done
- name: Clean Prod APK names and add Commit SHA
run: for f in android/app/build/outputs/apk/prod/release/*unsigned.apk; do mv "$f" "$(echo "$f" | sed s/unsigned/${{ inputs.brand }}-${{ steps.vars.outputs.sha_short }}/)"; done
- name: Sign Dev APK
id: sign_app_dev
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: android/app/build/outputs/apk/dev/release
signingKeyBase64: ${{ secrets[format('{0}_ANDROID_SIGNING_KEY', inputs.brand)] }}
alias: ${{ secrets[format('{0}_ANDROID_ALIAS', inputs.brand)] }}
keyStorePassword: ${{ secrets[format('{0}_ANDROID_KEY_STORE_PASSWORD', inputs.brand)] }}
keyPassword: ${{ secrets[format('{0}_ANDROID_KEY_PASSWORD', inputs.brand)] }}
env:
BUILD_TOOLS_VERSION: "33.0.0"
- name: Upload Dev artifact to GitHub
uses: actions/upload-artifact@v3
with:
name: Signed Android Package Dev Env ${{ inputs.brand }}
path: |
android/app/build/outputs/apk/dev/release/*-signed.apk
- name: Sign Prod APK
id: sign_app_prod
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: android/app/build/outputs/apk/prod/release
signingKeyBase64: ${{ secrets[format('{0}_ANDROID_SIGNING_KEY', inputs.brand)] }}
alias: ${{ secrets[format('{0}_ANDROID_ALIAS', inputs.brand)] }}
keyStorePassword: ${{ secrets[format('{0}_ANDROID_KEY_STORE_PASSWORD', inputs.brand)] }}
keyPassword: ${{ secrets[format('{0}_ANDROID_KEY_PASSWORD', inputs.brand)] }}
env:
BUILD_TOOLS_VERSION: "33.0.0"
- name: Upload Prod artifact to GitHub
uses: actions/upload-artifact@v3
with:
name: Signed Android Package Prod Env ${{ inputs.brand }}
path: |
android/app/build/outputs/apk/prod/release/*-signed.apk