Update project #141
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: Check Commit CI | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
workflow_dispatch: | |
concurrency: | |
group: environment-${{ github.ref }} | |
cancel-in-progress: false | |
jobs: | |
build: | |
env: | |
KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }} | |
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }} | |
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }} | |
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v4 | |
- name: setup jdk 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: cache gradle dependencies | |
uses: actions/cache@v3 | |
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: assemble release artifact | |
# run: ./gradlew assembleRelease | |
- name: upload artifacts to outputs | |
uses: actions/upload-artifact@v4 | |
with: | |
path: | | |
android-template/app/build/outputs/apk | |
- name: expose version name | |
id: version_name | |
run: | | |
VERSION_NAME=$(./gradlew printVersionName -q) | |
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV | |
- name: expose version code | |
id: version_code | |
run: | | |
VERSION_CODE=$(./gradlew printVersionCode -q) | |
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV | |
- name: expose apk path | |
run: | | |
echo "APK_PATH=$(find android-template/app/build/outputs/apk/**/**/*.apk)" >> $GITHUB_ENV | |
- name: expose short commit sha | |
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $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> ${{ env.SHORT_SHA }} | |
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" |