67 lines
No EOL
2 KiB
YAML
67 lines
No EOL
2 KiB
YAML
name: Build APK
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
build:
|
|
name: Build and push
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: "temurin"
|
|
java-version: "17"
|
|
|
|
- name: Make Gradle executable
|
|
run: chmod +x ./gradlew
|
|
|
|
- name: Build APKs
|
|
run: |
|
|
# Retry the Gradle build up to 3 times to mitigate transient cache/service errors
|
|
ATTEMPT=0
|
|
until [ $ATTEMPT -ge 3 ]
|
|
do
|
|
./gradlew build --no-daemon --stacktrace && break
|
|
ATTEMPT=$((ATTEMPT+1))
|
|
echo "Gradle build failed, retrying ($ATTEMPT/3)..."
|
|
sleep 5
|
|
done
|
|
if [ $ATTEMPT -ge 3 ]; then
|
|
echo "Gradle build failed after 3 attempts"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Setup directories
|
|
run:
|
|
mkdir -p /tmp/ShiggyXposedbuild/apks
|
|
mkdir -p /tmp/ShiggyXposedbuild/tools
|
|
|
|
- name: Move debug APK
|
|
run: mv ./app/build/outputs/apk/debug/app-debug.apk /tmp/ShiggyXposedbuild/apks
|
|
|
|
- name: Download uber-apk-signer
|
|
run: wget -nv "https://github.com/patrickfav/uber-apk-signer/releases/download/v1.2.1/uber-apk-signer-1.2.1.jar" -O /tmp/ShiggyXposedbuild/tools/uber-apk-signer.jar
|
|
|
|
- name: Sign release APK
|
|
run: java -jar /tmp/ShiggyXposedbuild/tools/uber-apk-signer.jar --apks ./app/build/outputs/apk/release/app-release-unsigned.apk --out /tmp/ShiggyXposedbuild/apks/
|
|
|
|
- name: Rename release APK
|
|
run: mv /tmp/ShiggyXposedbuild/apks/app-release-aligned-debugSigned.apk /tmp/ShiggyXposedbuild/apks/app-release.apk
|
|
|
|
- name: Upload debug APK
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-debug
|
|
path: /tmp/ShiggyXposedbuild/apks/app-debug.apk
|
|
|
|
- name: Upload All APKs
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-release
|
|
path: /tmp/ShiggyXposedbuild/apks/app-release.apk |