-
Notifications
You must be signed in to change notification settings - Fork 4
148 lines (133 loc) · 4.59 KB
/
build-f-droid-apk.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
name: Build FDroid APK
on:
workflow_dispatch:
push:
tags:
- 'fdroid-v*.*.*'
- 'v*.*.*'
paths-ignore:
- 'README.md'
- 'wiki/**'
- 'public/**'
- 'scripts/**'
- '.vscode'
- '.idea'
pull_request:
branches:
- master
- main
paths-ignore:
- 'README.md'
- 'wiki/**'
- 'public/**'
- '.scripts/**'
- '.vscode'
- '.idea'
jobs:
build:
name: Install and build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: pnpm
- name: Set Up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
- name: Setup Gradle # fix `incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.`
uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.0.1 # use the gradle version I saw on eas build's console, which might match the kotlin version?
- name: Set Build Tools Version
run: |
echo "BUILD_TOOLS_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | sort -V | tail -n 1)" >> $GITHUB_ENV
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Initialize and Update Submodules
run: pnpm run init-submodules
- name: Fix gradle error
run: pnpm exec zx scripts/fix-gradle.mjs
## configure cash for gradle : will help to reduce build time
- name: Cache Gradle Wrapper and Dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build by eject eas
run: npx expo prebuild -p android --clean
# TODO: https://github.com/tiddly-gittly/TidGi-Mobile/issues/6
# - name: Remove prorietary bits (for fix f-droid)
# run: npx zx scripts/fit-f-droid.mjs
- name: Build AAB
run: |
cd android
./gradlew clean
./gradlew bundleRelease --no-daemon --warning-mode all
- name: Sign AAB
id: sign_app_aab
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: android/app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOLS_VERSION }}
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
generate_release_notes: true
files: android/app/build/outputs/bundle/release/app-release.aab
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build APK
run: |
cd android
./gradlew clean
./gradlew assembleRelease --no-daemon --warning-mode all
## sign generated apk
- name: Sign APK
id: sign_app_apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: android/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOLS_VERSION }}
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
generate_release_notes: true
files: android/app/build/outputs/apk/release/app-release-signed.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}