mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-05-03 16:50:25 +00:00
- Improved Termux:X11 for Android 14+. - dwm is no longer used. - X11 Server has been removed.
102 lines
3.7 KiB
YAML
102 lines
3.7 KiB
YAML
name: Android CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
environment: BuildAPK
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '21'
|
|
distribution: 'temurin'
|
|
cache: gradle
|
|
|
|
- name: Grant execute permission for gradlew
|
|
run: chmod +x gradlew
|
|
|
|
- name: Send notification to Telegram
|
|
run: |
|
|
if [[ -n "${{ secrets.TELEGRAM_BOT_TOKEN }}" ]]; then
|
|
for chat in \
|
|
"-d chat_id=${{ secrets.TELEGRAM_CHAT_ID }} -d message_thread_id=8" \
|
|
"-d chat_id=${{ secrets.TELEGRAM_CHAT_ID_VEC }}"; do
|
|
curl -s -o /dev/null -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
|
|
$chat \
|
|
-d $'text=New update available on GitHub repository and building APK.\nPlease wait about 5 minutes.\nRun ID: '${GITHUB_RUN_ID}
|
|
done
|
|
fi
|
|
|
|
- name: Build Debug APK
|
|
run: ./gradlew assembleDebug
|
|
|
|
- name: Build Release APK
|
|
run: ./gradlew assembleRelease
|
|
|
|
- name: Upload Debug APK as artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: android-debug-apk
|
|
path: app/build/outputs/apk/debug/app-debug.apk
|
|
|
|
- name: Upload Release APK as artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: android-release-apk
|
|
path: app/build/outputs/apk/release/app-release.apk
|
|
|
|
- name: Upload to Telegram
|
|
run: |
|
|
if [[ -n "${{ secrets.TELEGRAM_BOT_TOKEN }}" ]]; then
|
|
success=true
|
|
|
|
for file in app/build/outputs/apk/release/*.apk; do
|
|
echo "Uploading $(basename "$file")"
|
|
tries=0
|
|
success_file=false
|
|
until [ $tries -ge 5 ]; do
|
|
success_targets=false
|
|
for target in \
|
|
"-F chat_id=${{ secrets.TELEGRAM_CHAT_ID }} -F message_thread_id=8" \
|
|
"-F chat_id=${{ secrets.TELEGRAM_CHAT_ID_VEC }}"; do
|
|
|
|
if curl -s -o /dev/null -F document=@"$file" $target \
|
|
-F $'caption=Done! Note that this is a version that is automatically built when there are changes in the GitHub repository, not the official version. Please only install it if you really want to see what is new.\nExplore beta releases here: https://github.com/AnBui2004/Vectras-VM-Emu-Android/releases\nRun ID: '${GITHUB_RUN_ID} \
|
|
https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument; then
|
|
success_targets=true
|
|
else
|
|
echo "Retrying upload for $file to target..."
|
|
sleep 2
|
|
fi
|
|
done
|
|
|
|
if $success_targets; then
|
|
success_file=true
|
|
break
|
|
fi
|
|
tries=$((tries+1))
|
|
done
|
|
|
|
if ! $success_file; then
|
|
echo "Upload failed for $file"
|
|
success=false
|
|
fi
|
|
done
|
|
|
|
if [ "$success" = false ]; then
|
|
for chat in \
|
|
"-d chat_id=${{ secrets.TELEGRAM_CHAT_ID }} -d message_thread_id=8" \
|
|
"-d chat_id=${{ secrets.TELEGRAM_CHAT_ID_VEC }}"; do
|
|
curl -s -o /dev/null -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
|
|
$chat \
|
|
-d $'text=Something went wrong and the APK file could not be uploaded.\nExplore beta releases here: https://github.com/AnBui2004/Vectras-VM-Emu-Android/releases\nRun ID: '${GITHUB_RUN_ID}
|
|
done
|
|
fi
|
|
fi
|