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: Automatic Build + Upload on push | |
| on: | |
| push: | |
| branches: [ "new" ] | |
| paths-ignore: | |
| - '.gitignore' | |
| - 'app/.gitignore' | |
| - '*.md' | |
| - 'LICENSE' | |
| env: | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'corretto' | |
| java-version: '11' | |
| - name: Decode the Keystore | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| run: | | |
| echo "$KEYSTORE_BASE64" | base64 --decode > $GITHUB_WORKSPACE/KEYSTORE.JKS | |
| - name: Build Release APK | |
| run: | | |
| ./gradlew clean assembleRelease | |
| - name: Build Debug APK | |
| run: | | |
| ./gradlew assembleDebug | |
| - name: Find Release APK file | |
| id: find-release-apk | |
| run: | | |
| release_apk=$(ls -t $GITHUB_WORKSPACE/app/build/outputs/apk/release/*.apk | head -n1) | |
| release_apk_filename=$(basename "$release_apk" .apk) | |
| echo "release_apk_path=$release_apk" >> $GITHUB_OUTPUT | |
| echo "release_apk_filename=$release_apk_filename" >> $GITHUB_OUTPUT | |
| - name: Find Debug APK file | |
| id: find-debug-apk | |
| run: | | |
| debug_apk=$(ls -t $GITHUB_WORKSPACE/app/build/outputs/apk/debug/*.apk | head -n1) | |
| debug_apk_filename=$(basename "$debug_apk" .apk) | |
| echo "debug_apk_path=$debug_apk" >> $GITHUB_OUTPUT | |
| echo "debug_apk_filename=$debug_apk_filename" >> $GITHUB_OUTPUT | |
| - name: Send commit info to Telegram | |
| uses: appleboy/telegram-action@master | |
| with: | |
| to: ${{ secrets.TELEGRAM_CHANNEL_ID}} | |
| token: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| message: | | |
| New commit from: ${{ github.actor }} | |
| Commit message: ${{ github.event.commits[0].message }} | |
| Changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} | |
| - name: Upload Release APK to Telegram | |
| uses: appleboy/telegram-action@master | |
| with: | |
| to: ${{ secrets.TELEGRAM_CHANNEL_ID }} | |
| token: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| message: ' ' | |
| document: ${{ steps.find-release-apk.outputs.release_apk_path }} | |
| - name: Upload Debug APK to Telegram | |
| uses: appleboy/telegram-action@master | |
| with: | |
| to: ${{ secrets.TELEGRAM_CHANNEL_ID }} | |
| token: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| message: ' ' | |
| document: ${{ steps.find-debug-apk.outputs.debug_apk_path }} | |
| - name: Upload Release files to Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.find-release-apk.outputs.release_apk_filename }} | |
| path: app/build/outputs/apk/release/ | |
| - name: Upload Debug files to Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.find-debug-apk.outputs.debug_apk_filename }} | |
| path: app/build/outputs/apk/debug/ |