Repository navigation
203 lines (182 loc) · 6.63 KB
/
Copy pathBuild.yml
File metadata and controls
203 lines (182 loc) · 6.63 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: BuildCI
on:
push:
paths-ignore:
- 'README.md'
pull_request:
paths-ignore:
- 'README.md'
release:
types: [published]
workflow_dispatch:
inputs:
simulate_release:
description: '¿Simulate a release event?'
type: boolean
default: false
jobs:
build-modern:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Perms Gradle
run: chmod 777 gradlew
- name: Set Key
run: echo "${{ secrets.CREAFDKEYAPPB }}" | base64 -d > app/CreaFD.keystore
- name: Build App (Modern)
env:
CREAFDKEYCONTREAPP: ${{ secrets.CREAFDKEYCONTREAPP }}
run: |
if [ "${{ github.event_name }}" = "release" ] || [ "${{ inputs.simulate_release }}" = "true" ]; then
./gradlew :app:assembleRelease --no-daemon
else
./gradlew :app:assembleDebug --no-daemon
fi
- name: Rename Modern Release APK
if: github.event_name == 'release' || inputs.simulate_release
run: |
cd app/build/outputs/apk/release/
for f in *.apk; do mv "$f" "${f%.apk}-modern.apk"; done
- name: Upload APK artifact (Modern)
uses: actions/upload-artifact@v7
with:
name: ${{ (github.event_name == 'release' || inputs.simulate_release) && 'CreaFDroidApp-Modern-Release' || 'CreaFDroidApp-Modern-Debug' }}
path: ${{ (github.event_name == 'release' || inputs.simulate_release) && 'app/build/outputs/apk/release/*.apk' || 'app/build/outputs/apk/debug/*.apk' }}
build-legacy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: sdk9
submodules: true
- name: Set up JDK 8 (For Legacy Gradle)
id: setup-jdk8
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 8
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
- name: Install 32-bit libraries for legacy AAPT
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y \
libc6:i386 \
lib32z1 \
lib32stdc++6 \
libstdc++6:i386 \
libncurses6:i386 \
libtinfo6:i386
sudo ln -sf /lib/i386-linux-gnu/libtinfo.so.6 /lib/i386-linux-gnu/libtinfo.so.5 || true
sudo ln -sf /lib/i386-linux-gnu/libncurses.so.6 /lib/i386-linux-gnu/libncurses.so.5 || true
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
packages: ''
- name: Install Android Build-Tools 23.0.3
run: |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses || true
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "build-tools;23.0.3" "platforms;android-23"
- name: Fix missing proguard-android.txt
run: |
mkdir -p $ANDROID_HOME/tools/proguard
cat << 'EOF' > $ANDROID_HOME/tools/proguard/proguard-android.txt
# Standard Android ProGuard rules
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
-dontoptimize
-dontpreverify
-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
-dontwarn android.support.**
EOF
- name: Perms Gradle
run: chmod 777 gradlew
- name: Set Key
run: echo "${{ secrets.CREAFDKEYAPPB }}" | base64 -d > app/CreaFD.keystore
- name: Build App (Legacy)
env:
CREAFDKEYCONTREAPP: ${{ secrets.CREAFDKEYCONTREAPP }}
JAVA_HOME: ${{ steps.setup-jdk8.outputs.path }}
run: |
if [ "${{ github.event_name }}" = "release" ] || [ "${{ inputs.simulate_release }}" = "true" ]; then
./gradlew :app:assembleRelease --no-daemon
else
./gradlew :app:assembleDebug --no-daemon
fi
- name: Rename Legacy Release APK
if: github.event_name == 'release' || inputs.simulate_release
run: |
find app/build/outputs/apk/ -name "*.apk" -exec sh -c '
for f; do
mv "$f" "${f%.apk}-legacy.apk"
done
' sh {} +
- name: Upload APK artifact (Legacy)
uses: actions/upload-artifact@v7
with:
name: ${{ (github.event_name == 'release' || inputs.simulate_release) && 'CreaFDroidApp-Legacy-Release' || 'CreaFDroidApp-Legacy-Debug' }}
path: app/build/outputs/apk/**/*.apk
publish-release:
if: github.event_name == 'release' || inputs.simulate_release
needs: [build-modern, build-legacy]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Modern Release APK
uses: actions/download-artifact@v4
with:
name: CreaFDroidApp-Modern-Release
path: release-apks/modern
- name: Download Legacy Release APK
uses: actions/download-artifact@v4
with:
name: CreaFDroidApp-Legacy-Release
path: release-apks/legacy
- name: Attach Both APKs to GitHub Release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v3
with:
files: |
release-apks/modern/*.apk
release-apks/legacy/*.apk
- name: Sync FDroid Repo
if: github.event_name == 'release'
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.FDROID_SYNC }}
repository: Creadores-Program/CreaProFDR
event-type: app_updated
client-payload: '{"app_name": "${{ github.event.repository.name }}"}'