fix: crash got null config #62
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: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ !startsWith(github.event.head_commit.message, '[skip ci]') }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
cache: 'gradle' | |
- name: Cache Gradle Dependencies | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
!~/.gradle/caches/build-cache-* | |
key: gradle-deps-core-${{ hashFiles('**/build.gradle.kts') }} | |
restore-keys: | | |
gradle-deps | |
- name: Cache Gradle Build | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.gradle/caches/build-cache-* | |
~/.gradle/buildOutputCleanup/cache.properties | |
key: gradle-builds-core-${{ github.sha }} | |
restore-keys: | | |
gradle-builds | |
- name: Build with Gradle | |
env: | |
REL_KEY: ${{ secrets.REL_KEY }} | |
# APP_SECRET: ${{ secrets.APP_SECRET }} | |
run: | | |
bash ./gradlew assembleRelease assembleDebug | |
- name: Upload built apk | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: snapshot | |
path: | | |
${{ github.workspace }}/app/build/outputs/apk | |
# ${{ github.workspace }}/app/build/outputs/mapping | |
upload-telegram: | |
name: Upload Release | |
if: ${{ success() && github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- telegram-bot-api | |
steps: | |
- name: Donwload Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Download Telegram Bot API Binary | |
uses: actions/download-artifact@master | |
with: | |
name: telegram-bot-api-binary | |
path: . | |
- name: Release | |
env: | |
COMMIT_MESSAGE: |+ | |
New push to github\! | |
``` | |
${{ github.event.head_commit.message }} | |
```by `${{ github.event.head_commit.author.name }}` | |
See commit detail [here](${{ github.event.head_commit.url }}) | |
COMMIT_URL: ${{ github.event.head_commit.url }} | |
run: | | |
ESCAPED=`python3 -c 'import json,os,urllib.parse; msg = json.dumps(os.environ["COMMIT_MESSAGE"]); print(urllib.parse.quote(msg if len(msg) <= 1024 else json.dumps(os.environ["COMMIT_URL"])))'` | |
export release=$(find artifacts -name "app-release.apk") | |
export debug=$(find artifacts -name "app-debug.apk") | |
chmod +x telegram-bot-api-binary | |
./telegram-bot-api-binary --api-id=21724 --api-hash=3e0cb5efcd52300aec5994fdfc5bdc16 --local 2>&1 > /dev/null & | |
curl -v "http://127.0.0.1:8081/bot${{ secrets.TELEGRAM_TOKEN }}/sendMediaGroup?chat_id=-1001768185782&message_thread_id=97&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fdebug%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Frelease%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22:${ESCAPED}%7D%5D" \ | |
-F debug="@$debug" \ | |
-F release="@$release" | |
pkill telegram-bot | |
telegram-bot-api: | |
name: Telegram Bot API | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Clone Telegram Bot API | |
run: | | |
git clone --recursive https://github.com/tdlib/telegram-bot-api.git | |
git status telegram-bot-api >> telegram-bot-api-status | |
- name: Cache Bot API Binary | |
id: cache-bot-api | |
uses: actions/[email protected] | |
with: | |
path: telegram-bot-api-binary | |
key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }} | |
- name: Compile Telegram Bot API | |
if: steps.cache-bot-api.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get update | |
sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++ | |
cd telegram-bot-api | |
rm -rf build | |
mkdir build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. | |
cmake --build . --target install -j$(nproc) | |
cd ../.. | |
ls -l telegram-bot-api/bin/telegram-bot-api* | |
cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary | |
- name: Upload Binary | |
uses: actions/upload-artifact@master | |
with: | |
name: telegram-bot-api-binary | |
path: telegram-bot-api-binary |