Skip to content

Commit 066ec15

Browse files
committed
update: workflows
1 parent a5d19b9 commit 066ec15

7 files changed

Lines changed: 378 additions & 90 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Restricts the foss flavor to arm64-v8a only.
3+
* This runs after the project is fully evaluated, so it overrides whatever
4+
* abiFilters were set in the build.gradle without touching that file.
5+
*/
6+
allprojects {
7+
afterEvaluate { project ->
8+
def androidExtension = project.extensions.findByName('android')
9+
if (androidExtension != null) {
10+
androidExtension.productFlavors.each { flavor ->
11+
if (flavor.name == 'foss') {
12+
flavor.ndk.abiFilters.clear()
13+
flavor.ndk.abiFilters.add('arm64-v8a')
14+
}
15+
}
16+
}
17+
}
18+
}
19+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Restricts the foss flavor to armeabi-v7a only.
3+
* The main build.gradle intentionally excludes 32-bit archs, so this init
4+
* script clears those filters and adds the 32-bit ARM ABI instead.
5+
*/
6+
allprojects {
7+
afterEvaluate { project ->
8+
def androidExtension = project.extensions.findByName('android')
9+
if (androidExtension != null) {
10+
androidExtension.productFlavors.each { flavor ->
11+
if (flavor.name == 'foss') {
12+
flavor.ndk.abiFilters.clear()
13+
flavor.ndk.abiFilters.add('armeabi-v7a')
14+
}
15+
}
16+
}
17+
}
18+
}
19+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Restricts the foss flavor to x86 only.
3+
* The main build.gradle intentionally excludes 32-bit archs, so this init
4+
* script clears those filters and adds the 32-bit x86 ABI instead.
5+
*/
6+
allprojects {
7+
afterEvaluate { project ->
8+
def androidExtension = project.extensions.findByName('android')
9+
if (androidExtension != null) {
10+
androidExtension.productFlavors.each { flavor ->
11+
if (flavor.name == 'foss') {
12+
flavor.ndk.abiFilters.clear()
13+
flavor.ndk.abiFilters.add('x86')
14+
}
15+
}
16+
}
17+
}
18+
}
19+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Restricts the foss flavor to x86_64 only.
3+
* This runs after the project is fully evaluated, so it overrides whatever
4+
* abiFilters were set in the build.gradle without touching that file.
5+
*/
6+
allprojects {
7+
afterEvaluate { project ->
8+
def androidExtension = project.extensions.findByName('android')
9+
if (androidExtension != null) {
10+
androidExtension.productFlavors.each { flavor ->
11+
if (flavor.name == 'foss') {
12+
flavor.ndk.abiFilters.clear()
13+
flavor.ndk.abiFilters.add('x86_64')
14+
}
15+
}
16+
}
17+
}
18+
}
19+

.github/workflows/build_pre_release.yml

Lines changed: 101 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,44 @@ jobs:
3131
echo "version_name=$VERSION_NAME" >> $GITHUB_OUTPUT
3232
echo "tag=$TAG" >> $GITHUB_OUTPUT
3333
34-
# Builds the pre-release APK targeting arm64-v8a devices only.
35-
build-arm64:
34+
# Each arch is built in its own job using a Gradle init script that overrides
35+
# the foss flavor's abiFilters. This avoids android.injected.build.abi, which
36+
# would stamp the APK as testOnly and make it uninstallable on real devices.
37+
38+
build-arm64-v8a:
3639
name: Build arm64-v8a
3740
runs-on: ubuntu-latest
3841
needs: prepare
39-
4042
steps:
4143
- name: Checkout code
4244
uses: actions/checkout@v4
43-
4445
- name: Set up Java and Android SDK
4546
uses: actions/setup-java@v4
4647
with:
4748
java-version: '21'
4849
distribution: 'temurin'
49-
5050
- name: Decode keystore
5151
uses: timheuer/base64-to-file@v1
5252
with:
5353
fileName: 'keystore/key.jks'
5454
encodedString: ${{ secrets.SIGN_KEY }}
55-
5655
- name: Accept Android SDK licenses
5756
run: yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
58-
5957
- name: Build arm64-v8a release APK
6058
run: |
6159
chmod +x ./gradlew
62-
./gradlew clean assembleFossRelease -Pandroid.injected.build.abi=arm64-v8a --no-build-cache --rerun-tasks
60+
./gradlew clean assembleFossRelease \
61+
--init-script .github/init-scripts/abi-arm64-v8a.gradle \
62+
--no-build-cache --rerun-tasks
6363
env:
6464
SIGNING_KEY_ALIAS: ${{ secrets.ALIAS }}
6565
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
6666
SIGNING_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
67-
6867
- name: Rename APK to felicity-foss-arm64-v8a.apk
6968
run: |
7069
mkdir -p ${{ runner.temp }}/apks
7170
APK=$(find music/ -name "*.apk" | head -n 1)
7271
mv "$APK" "${{ runner.temp }}/apks/felicity-foss-arm64-v8a.apk"
73-
7472
- name: Upload arm64-v8a APK
7573
uses: actions/upload-artifact@v4
7674
with:
@@ -79,46 +77,40 @@ jobs:
7977
retention-days: 1
8078
if-no-files-found: error
8179

82-
# Builds the pre-release APK targeting x86_64 devices only.
8380
build-x86_64:
8481
name: Build x86_64
8582
runs-on: ubuntu-latest
8683
needs: prepare
87-
8884
steps:
8985
- name: Checkout code
9086
uses: actions/checkout@v4
91-
9287
- name: Set up Java and Android SDK
9388
uses: actions/setup-java@v4
9489
with:
9590
java-version: '21'
9691
distribution: 'temurin'
97-
9892
- name: Decode keystore
9993
uses: timheuer/base64-to-file@v1
10094
with:
10195
fileName: 'keystore/key.jks'
10296
encodedString: ${{ secrets.SIGN_KEY }}
103-
10497
- name: Accept Android SDK licenses
10598
run: yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
106-
10799
- name: Build x86_64 release APK
108100
run: |
109101
chmod +x ./gradlew
110-
./gradlew clean assembleFossRelease -Pandroid.injected.build.abi=x86_64 --no-build-cache --rerun-tasks
102+
./gradlew clean assembleFossRelease \
103+
--init-script .github/init-scripts/abi-x86_64.gradle \
104+
--no-build-cache --rerun-tasks
111105
env:
112106
SIGNING_KEY_ALIAS: ${{ secrets.ALIAS }}
113107
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
114108
SIGNING_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
115-
116109
- name: Rename APK to felicity-foss-x86_64.apk
117110
run: |
118111
mkdir -p ${{ runner.temp }}/apks
119112
APK=$(find music/ -name "*.apk" | head -n 1)
120113
mv "$APK" "${{ runner.temp }}/apks/felicity-foss-x86_64.apk"
121-
122114
- name: Upload x86_64 APK
123115
uses: actions/upload-artifact@v4
124116
with:
@@ -127,31 +119,108 @@ jobs:
127119
retention-days: 1
128120
if-no-files-found: error
129121

130-
# Waits for both arch builds, then publishes a pre-release on GitHub with both APKs attached.
131-
publish:
132-
name: Publish Pre-Release
122+
build-armeabi-v7a:
123+
name: Build armeabi-v7a
133124
runs-on: ubuntu-latest
134-
needs: [ prepare, build-arm64, build-x86_64 ]
125+
needs: prepare
126+
steps:
127+
- name: Checkout code
128+
uses: actions/checkout@v4
129+
- name: Set up Java and Android SDK
130+
uses: actions/setup-java@v4
131+
with:
132+
java-version: '21'
133+
distribution: 'temurin'
134+
- name: Decode keystore
135+
uses: timheuer/base64-to-file@v1
136+
with:
137+
fileName: 'keystore/key.jks'
138+
encodedString: ${{ secrets.SIGN_KEY }}
139+
- name: Accept Android SDK licenses
140+
run: yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
141+
- name: Build armeabi-v7a release APK
142+
run: |
143+
chmod +x ./gradlew
144+
./gradlew clean assembleFossRelease \
145+
--init-script .github/init-scripts/abi-armeabi-v7a.gradle \
146+
--no-build-cache --rerun-tasks
147+
env:
148+
SIGNING_KEY_ALIAS: ${{ secrets.ALIAS }}
149+
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
150+
SIGNING_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
151+
- name: Rename APK to felicity-foss-armeabi-v7a.apk
152+
run: |
153+
mkdir -p ${{ runner.temp }}/apks
154+
APK=$(find music/ -name "*.apk" | head -n 1)
155+
mv "$APK" "${{ runner.temp }}/apks/felicity-foss-armeabi-v7a.apk"
156+
- name: Upload armeabi-v7a APK
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: felicity-foss-armeabi-v7a
160+
path: ${{ runner.temp }}/apks/felicity-foss-armeabi-v7a.apk
161+
retention-days: 1
162+
if-no-files-found: error
135163

164+
build-x86:
165+
name: Build x86
166+
runs-on: ubuntu-latest
167+
needs: prepare
136168
steps:
137-
- name: Download arm64-v8a APK
138-
uses: actions/download-artifact@v4
169+
- name: Checkout code
170+
uses: actions/checkout@v4
171+
- name: Set up Java and Android SDK
172+
uses: actions/setup-java@v4
139173
with:
140-
name: felicity-foss-arm64-v8a
141-
path: artifacts/
174+
java-version: '21'
175+
distribution: 'temurin'
176+
- name: Decode keystore
177+
uses: timheuer/base64-to-file@v1
178+
with:
179+
fileName: 'keystore/key.jks'
180+
encodedString: ${{ secrets.SIGN_KEY }}
181+
- name: Accept Android SDK licenses
182+
run: yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
183+
- name: Build x86 release APK
184+
run: |
185+
chmod +x ./gradlew
186+
./gradlew clean assembleFossRelease \
187+
--init-script .github/init-scripts/abi-x86.gradle \
188+
--no-build-cache --rerun-tasks
189+
env:
190+
SIGNING_KEY_ALIAS: ${{ secrets.ALIAS }}
191+
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
192+
SIGNING_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
193+
- name: Rename APK to felicity-foss-x86.apk
194+
run: |
195+
mkdir -p ${{ runner.temp }}/apks
196+
APK=$(find music/ -name "*.apk" | head -n 1)
197+
mv "$APK" "${{ runner.temp }}/apks/felicity-foss-x86.apk"
198+
- name: Upload x86 APK
199+
uses: actions/upload-artifact@v4
200+
with:
201+
name: felicity-foss-x86
202+
path: ${{ runner.temp }}/apks/felicity-foss-x86.apk
203+
retention-days: 1
204+
if-no-files-found: error
205+
206+
# Waits for all arch builds to finish, then publishes a pre-release on GitHub with all APKs attached.
207+
publish:
208+
name: Publish Pre-Release
209+
runs-on: ubuntu-latest
210+
needs: [ prepare, build-arm64-v8a, build-x86_64, build-armeabi-v7a, build-x86 ]
142211

143-
- name: Download x86_64 APK
212+
steps:
213+
- name: Download all APKs
144214
uses: actions/download-artifact@v4
145215
with:
146-
name: felicity-foss-x86_64
216+
pattern: felicity-foss-*
147217
path: artifacts/
218+
merge-multiple: true
148219

149220
- name: Create GitHub Pre-Release
150221
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631
151222
with:
152-
files: |
153-
artifacts/felicity-foss-arm64-v8a.apk
154-
artifacts/felicity-foss-x86_64.apk
223+
files: artifacts/*.apk
155224
name: ${{ needs.prepare.outputs.version_name }}
156225
tag_name: ${{ needs.prepare.outputs.tag }}
157226
prerelease: true
@@ -161,4 +230,3 @@ jobs:
161230
**Commit:** ${{ github.sha }}
162231
env:
163232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164-

0 commit comments

Comments
 (0)