-
-
Notifications
You must be signed in to change notification settings - Fork 37
76 lines (63 loc) · 2.23 KB
/
build-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
name: Build an Android APK
on:
push:
paths:
- '*'
- '.github/workflows/build-android.yml'
- 'android/**'
- 'src/**'
- '!**/*.md'
branches:
- main
jobs:
build-apk:
permissions:
contents: write
name: Build Android APK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Optional security step: Validate whether gradle-wrapper.jar is valid or malicious
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
# 'corepack enable' is needed for now till it's experimental, may remove the command once it becomes stable in later node releases
- name: Enable Corepack
run: corepack enable
# Setup Web environment to install packages.
- name: Setup Web environment
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
# Setup Java environment in order to build the Android app.
- name: Setup Java environment
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
# Setup gradle using official gradle action
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
add-job-summary: 'on-failure'
- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-node-modules-
# Here '--immutable' will only use commited 'yarn.lock', and will throw error if some update is needed
- name: Install node_modules
run: yarn install --immutable
# In some cases, Gradle is not executable by default, so we do this before the build process
- name: Make gradlew executable
working-directory: android
run: chmod +x ./gradlew
- name: Build Android release APK
working-directory: android
run: ./gradlew assembleRelease --no-daemon
- name: Save apk file as artifact
uses: actions/upload-artifact@v4
with:
name: rn-animation-samples
path: android/app/build/outputs/apk/release/app-release.apk