Update project #36
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| paths-ignore: | |
| - '**.md' | |
| pull_request: | |
| paths-ignore: | |
| - '**.md' | |
| workflow_dispatch: | |
| concurrency: | |
| group: environment-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| job-common: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| SHORT_SHA: ${{ steps.expose_sha.outputs.short_sha }} | |
| steps: | |
| - name: expose short commit sha | |
| id: expose_sha | |
| run: | | |
| SHORT_SHA=${GITHUB_SHA::7} | |
| echo "short_sha=$SHORT_SHA" >> $GITHUB_ENV | |
| echo "SHORT_SHA=$SHORT_SHA" >> $GITHUB_OUTPUT | |
| build-android: | |
| needs: job-common | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 60 | |
| env: | |
| SHORT_SHA: ${{ needs.job-common.outputs.SHORT_SHA }} | |
| steps: | |
| - name: checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: setup jdk 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: cache gradle dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/caches | |
| key: gradle-${{ runner.os }}-${{ hashFiles('/*.gradle*', '/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| gradle-${{ runner.os }}- | |
| - name: cache gradle wrapper | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.gradle/wrapper | |
| key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | |
| - name: clean outputs directory | |
| run: rm -rf app/build/outputs/* | |
| - name: make gradlew executable | |
| run: chmod +x ./gradlew | |
| - name: assemble debug artifact | |
| run: ./gradlew assembleDebug | |
| - name: upload artifacts to outputs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| path: | | |
| app/build/outputs/apk | |
| - name: expose version | |
| id: version | |
| run: ./gradlew -q printVersion | tee -a $GITHUB_ENV | tee -a $GITHUB_OUTPUT | |
| - name: expose apk path | |
| run: | | |
| echo "APK_PATH=$(find app/build/outputs/apk -name '*.apk' -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2)" >> $GITHUB_ENV | |
| - name: send telegram message | |
| env: | |
| TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
| CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
| THREAD_ID: ${{ secrets.TELEGRAM_THREAD_ID }} | |
| MESSAGE: | | |
| ✅ <b>${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }})</b> | |
| <b>Ветка:</b> ${{ github.ref_name }} | |
| <b>Коммит:</b> <code>${{ env.SHORT_SHA }}</code> | |
| run: | | |
| curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendDocument" \ | |
| -F chat_id="${CHAT_ID}" \ | |
| -F document="@${{ env.APK_PATH }}" \ | |
| -F caption="${{ env.MESSAGE }}" \ | |
| -F message_thread_id="${THREAD_ID}" \ | |
| -F parse_mode="HTML" |