bugfix #89
This file contains hidden or 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: | |
| branches: [ "**" ] | |
| paths-ignore: | |
| - '**/*.md' | |
| pull_request: | |
| branches: [ "**" ] | |
| paths-ignore: | |
| - '**/*.md' | |
| workflow_dispatch: | |
| jobs: | |
| init: | |
| name: Init | |
| runs-on: ubuntu-latest | |
| environment: Release | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: notify telegram | |
| if: github.event_name != 'pull_request' | |
| uses: EverythingSuckz/github-telegram-notify@main | |
| continue-on-error: true | |
| with: | |
| bot_token: ${{ secrets.BOT_TOKEN }} | |
| chat_id: ${{ secrets.CHAT_ID }} | |
| topic_id: 4 | |
| build_preview_apk: | |
| name: Build App Preview APKs | |
| runs-on: ubuntu-latest | |
| env: | |
| TG_BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
| TG_CHAT_ID: ${{ secrets.CHAT_ID }} | |
| LOG_CHAT_ID: ${{ secrets.LOG_CHAT_ID }} | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| ALIAS_PASSWORD: ${{ secrets.ALIAS_PASSWORD }} | |
| environment: MainEnv | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'oracle' | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Validate Gradle wrapper | |
| uses: gradle/actions/wrapper-validation@v4 | |
| - name: Build Preview build for both ABIs | |
| if: github.event_name != 'pull_request' | |
| run: | # Use the pipe for multi-line commands | |
| ./gradlew assemblePreview \ | |
| -DLOG_CHAT_ID="${{ secrets.LOG_CHAT_ID }}" \ | |
| -DTG_BOT_TOKEN="${{ secrets.BOT_TOKEN }}" \ | |
| -DTG_CHAT_ID="${{ secrets.CHAT_ID }}" \ | |
| -DKEYSTORE_BASE64="${{ secrets.KEYSTORE_BASE64 }}" \ | |
| -DKEYSTORE_PASSWORD="${{ secrets.KEYSTORE_PASSWORD }}" \ | |
| -DKEY_ALIAS="${{ secrets.KEY_ALIAS }}" \ | |
| -DALIAS_PASSWORD="${{ secrets.ALIAS_PASSWORD }}" | |
| - name: Rename APKs with commit hash | |
| run: | | |
| HASH=${GITHUB_SHA::8} | |
| mv app/build/outputs/apk/preview/preview-arm64-v8a.apk app/build/outputs/apk/preview/preview-arm64-v8a-${HASH}.apk | |
| mv app/build/outputs/apk/preview/preview-armeabi-v7a.apk app/build/outputs/apk/preview/preview-armeabi-v7a-${HASH}.apk | |
| - name: Upload preview arm64 apk | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: preview-arm64 | |
| path: app/build/outputs/apk/preview/preview-arm64-v8a-*.apk | |
| - name: Upload preview armeabi apk | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: preview-armeabi | |
| path: app/build/outputs/apk/preview/preview-armeabi-v7a-*.apk | |
| send_preview_apks: | |
| name: Send Preview APKs | |
| runs-on: ubuntu-latest | |
| needs: build_preview_apk | |
| environment: Release | |
| steps: | |
| - name: Download arm64 apk | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: preview-arm64 | |
| path: . | |
| - name: Download armeabi apk | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: preview-armeabi | |
| path: . | |
| - name: Send arm64 APK to Telegram | |
| if: success() && github.event_name != 'pull_request' | |
| continue-on-error: true | |
| run: | | |
| HASH=${GITHUB_SHA::8} | |
| curl -X POST "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendDocument" \ | |
| -F chat_id="${{ secrets.CHAT_ID }}" \ | |
| -F message_thread_id="4" \ | |
| -F document=@"preview-arm64-v8a-${HASH}.apk" \ | |
| -F caption="arm64-v8a Build" | |
| - name: Send armeabi APK to Telegram | |
| if: success() && github.event_name != 'pull_request' | |
| continue-on-error: true | |
| run: | | |
| HASH=${GITHUB_SHA::8} | |
| curl -X POST "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendDocument" \ | |
| -F chat_id="${{ secrets.CHAT_ID }}" \ | |
| -F message_thread_id="4" \ | |
| -F document=@"preview-armeabi-v7a-${HASH}.apk" \ | |
| -F caption="armeabi-v7a Build" |