Update XmlBuilder.java #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android CI | |
on: | |
push: | |
paths: | |
- '.github/workflows/android.yml' | |
- 'app/**' | |
- 'build-logic/**' | |
- 'kotlinc/**' | |
- 'gradle/**' | |
- 'build.gradle' | |
- 'gradle.properties' | |
- 'gradlew' | |
- 'gradlew.bat' | |
- 'public-stable-ids.txt' | |
- 'settings.gradle' | |
workflow_dispatch: | |
jobs: | |
notifyTelegram: | |
name: Notify Telegram | |
runs-on: ${{ vars.IS_USING_HOSTED_RUNNERS == 'true' && 'self-hosted' || 'ubuntu-latest' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Dependencies | |
run: | | |
pip install requests | |
- name: Send a message to Telegram | |
env: | |
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
TOPIC_ID: ${{ secrets.TELEGRAM_TOPIC_ID }} | |
run: | | |
python ./.github/workflows/notify_build_start_telegram.py | |
continue-on-error: true | |
build: | |
name: Build APKs | |
runs-on: ${{ vars.IS_USING_HOSTED_RUNNERS == 'true' && 'self-hosted' || 'ubuntu-latest' }} | |
strategy: | |
matrix: | |
apiLevel: [21, 26] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Set environmental variables | |
shell: bash | |
env: | |
JSON_CONTENT: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
if: ${{ env.JSON_CONTENT != '' }} | |
run: | | |
printf 'GOOGLE_SERVICES_JSON<<EOF\n%s\nEOF\n' "$JSON_CONTENT" >> $GITHUB_ENV | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build debug APK | |
id: build_apk | |
env: | |
SKETCHUB_API_KEY: ${{ secrets.SKETCHUB_API_KEY }} | |
run: gradle assembleMinApi${{ matrix.apiLevel }}Debug > build_output.txt 2>&1 | |
continue-on-error: true | |
# The following steps will run only if the build fails | |
- name: Set up Python 3 | |
if: ${{ steps.build_apk.outcome == 'failure' }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Dependencies | |
if: ${{ steps.build_apk.outcome == 'failure' }} | |
run: pip install requests | |
- name: Send error message to Telegram | |
if: ${{ steps.build_apk.outcome == 'failure' }} | |
env: | |
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
TOPIC_ID: ${{ secrets.TELEGRAM_TOPIC_ID }} | |
run: | | |
python ./.github/workflows/notify_build_fail_telegram.py --error-file build_output.txt | |
- name: Upload debug APK | |
if: ${{ steps.build_apk.outcome == 'success' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: apk-minApi${{ matrix.apiLevel }}-debug | |
path: app/build/outputs/apk/minApi${{ matrix.apiLevel }}/debug | |
aggregateAndSend: | |
name: Send APKs to Telegram | |
runs-on: ${{ vars.IS_USING_HOSTED_RUNNERS == 'true' && 'self-hosted' || 'ubuntu-latest' }} | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Artifacts for API 21 | |
uses: actions/download-artifact@v4 | |
with: | |
name: apk-minApi21-debug | |
path: ./downloaded-artifact/minApi21 | |
- name: Download Artifacts for API 26 | |
uses: actions/download-artifact@v4 | |
with: | |
name: apk-minApi26-debug | |
path: ./downloaded-artifact/minApi26 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Dependencies | |
run: | | |
pip install telethon | |
- name: Get Git Commit Info | |
run: | | |
echo "COMMIT_AUTHOR=$(git log -1 --pretty=format:'%an')" >> $GITHUB_ENV | |
echo "COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s')" >> $GITHUB_ENV | |
- name: Restore Telegram session cache | |
uses: actions/cache@v4 | |
id: telegram_session_cache | |
with: | |
path: bot_session.session | |
key: telegram-session-${{ runner.os }}-bot_session | |
- name: Send APKs to Telegram | |
env: | |
API_ID: ${{ secrets.TELEGRAM_API_ID }} | |
API_HASH: ${{ secrets.TELEGRAM_API_HASH }} | |
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
TOPIC_ID: ${{ secrets.TELEGRAM_TOPIC_ID }} | |
APK_MIN_API21: ./downloaded-artifact/minApi21/app-minApi21-debug.apk | |
APK_MIN_API26: ./downloaded-artifact/minApi26/app-minApi26-debug.apk | |
run: | | |
python ./.github/workflows/notify_build_success_telegram.py | |
continue-on-error: true |