forked from berty/berty
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (107 loc) · 3.69 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
name: Android
on:
push:
tags:
- v*
branches:
- master
paths:
- "go/**"
- "!go/**.md"
- "go.*"
- "**.go"
- "js/**"
- ".github/workflows/android.yml"
pull_request:
paths:
- "go/**"
- "!go/**.md"
- "go.*"
- "**.go"
- "js/**"
- "!js/packages/i18n/locale/*/*.json"
- ".github/workflows/android.yml"
jobs:
build:
name: Build for Android
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Load variables from file
uses: antifree/[email protected]
with:
filename: .github/workflows/utils/variables.json
- name: Setup asdf
uses: asdf-vm/actions/setup@v1
- name: Setup go
run: |
asdf plugin add golang
asdf install golang
echo "go_version=$(asdf current golang | xargs | cut -d ' ' -f 2)" >> $GITHUB_ENV
- name: Setup node
run: |
asdf plugin add nodejs
asdf install nodejs
echo "node_version=$(asdf current nodejs | xargs | cut -d ' ' -f 2)" >> $GITHUB_ENV
- name: Setup yarn
run: |
asdf plugin add yarn
asdf install yarn
- name: Setup java
run: |
asdf plugin add java
asdf install java
- name: Cache go modules
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-${{ hashFiles('go/**/go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-
- name: Cache node modules
uses: actions/[email protected]
with:
path: js/node_modules
key: ${{ runner.OS }}-node-${{ env.node_version }}-${{ env.json_cache-versions_node }}-${{ hashFiles('js/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-${{ env.node_version }}-${{ env.json_cache-versions_node }}-
- name: Cache gobridge aar
uses: n0izn0iz/mkache@5cedaeaf0b39a9220ae5a815cac8d2a924cee3ef
if: github.ref != 'refs/heads/master' # this makes sure the VCS_REF is correct on master
with:
rule: android/libs/gobridge.aar
makefile: js/Makefile
key: android-gomobile-bridge-${{ matrix.golang }}
- name: Fetch node modules
working-directory: js
run: make node_modules
- name: Build gobridge aar
working-directory: js
run: make android.gomobile
- name: Build the APK
working-directory: js
env:
CI: "true"
run: |
make android.app_deps
(yarn jetify && cd android && ./gradlew -i app:bundleReleaseYolo)
### TODO: move this part on Yolo and use release keystore ###
mkdir -p $HOME/.android
cp android/app/debug.keystore $HOME/.android
wget \
https://github.com/google/bundletool/releases/download/1.8.2/bundletool-all-1.8.2.jar \
-O /tmp/bundletool.jar
java -jar /tmp/bundletool.jar build-apks \
--bundle=android/app/build/outputs/bundle/releaseYolo/app-releaseYolo.aab \
--output=${{ github.workspace }}/app.apks \
--mode=universal
cd ${{ github.workspace }} && unzip app.apks
################################################
- name: Upload the APK
uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/universal.apk
name: berty-universal-${{github.sha}}.apk
if-no-files-found: error