mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-12-02 01:31:33 +01:00
Use self-hosted bot api server to upload
This commit is contained in:
parent
097acd41c7
commit
b472662a3f
47
.github/workflows/debug.yml
vendored
47
.github/workflows/debug.yml
vendored
@ -353,6 +353,7 @@ jobs:
|
||||
needs:
|
||||
- native
|
||||
- v2ray
|
||||
- telegram-bot-api
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
@ -387,6 +388,11 @@ jobs:
|
||||
with:
|
||||
path: ~/.gradle
|
||||
key: gradle-${{ hashFiles('**/*.gradle') }}
|
||||
- name: Download Telegram Bot API Binary
|
||||
uses: actions/download-artifact@master
|
||||
with:
|
||||
name: telegram-bot-api-binary
|
||||
path: .
|
||||
- name: Debug Build
|
||||
run: |
|
||||
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
|
||||
@ -395,10 +401,49 @@ jobs:
|
||||
./gradlew TMessagesProj:assembleMiniRelease
|
||||
- name: Send Build
|
||||
run: |
|
||||
chmod +x telegram-bot-api-binary
|
||||
./telegram-bot-api-binary --api-id=21724 --api-hash=3e0cb5efcd52300aec5994fdfc5bdc16 2>&1 > /dev/null &
|
||||
apk=$(find TMessagesProj/build/outputs/apk/mini/release -name '*arm64-v8a*.apk' | head -n 1)
|
||||
curl https://api.telegram.org/bot${{ secrets.HELPER_BOT_TOKEN }}/sendDocument \
|
||||
curl http://127.0.0.1:8081/bot${{ secrets.HELPER_BOT_TOKEN }}/sendDocument \
|
||||
-X POST \
|
||||
-F chat_id="${{ secrets.HELPER_BOT_TARGET }}" \
|
||||
-F document="@$apk" \
|
||||
-F caption="$GITHUB_SHA" \
|
||||
--silent --show-error --fail >/dev/null
|
||||
pkill telegram-bot
|
||||
|
||||
telegram-bot-api:
|
||||
name: Telegram Bot API
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- 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/cache@v2
|
||||
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
|
50
.github/workflows/release.yml
vendored
50
.github/workflows/release.yml
vendored
@ -359,20 +359,29 @@ jobs:
|
||||
name: Upload Release
|
||||
if: github.event.inputs.upload != 'y'
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
needs:
|
||||
- build
|
||||
- telegram-bot-api
|
||||
steps:
|
||||
- name: Donwload Artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: artifacts
|
||||
- name: Download Telegram Bot API Binary
|
||||
uses: actions/download-artifact@master
|
||||
with:
|
||||
name: telegram-bot-api-binary
|
||||
path: .
|
||||
- name: Release
|
||||
run: |
|
||||
chmod +x telegram-bot-api-binary
|
||||
./telegram-bot-api-binary --api-id=21724 --api-hash=3e0cb5efcd52300aec5994fdfc5bdc16 2>&1 > /dev/null &
|
||||
mkdir apks
|
||||
find artifacts -name "*.apk" -exec cp {} apks \;
|
||||
function upload() {
|
||||
for apk in $@; do
|
||||
echo ">> Uploading $apk"
|
||||
curl https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument \
|
||||
curl http://127.0.0.1:8081/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument \
|
||||
-X POST \
|
||||
-F chat_id="${{ secrets.TELEGRAM_CHANNEL }}" \
|
||||
-F document="@$apk" \
|
||||
@ -383,6 +392,7 @@ jobs:
|
||||
upload apks/NekoX-mini-*-releaseNoGcm.apk
|
||||
upload apks/NekoX-full-*-release.apk
|
||||
upload apks/NekoX-full-*-releaseNoGcm.apk
|
||||
pkill telegram-bot
|
||||
play:
|
||||
name: Publish to Play Store
|
||||
if: github.event.inputs.play != 'y'
|
||||
@ -463,3 +473,39 @@ jobs:
|
||||
EOF
|
||||
sed -i -e 's@<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />@@g' TMessagesProj/src/main/AndroidManifest.xml
|
||||
./gradlew TMessagesProj:publishMiniPlayReleaseApk
|
||||
|
||||
telegram-bot-api:
|
||||
name: Telegram Bot API
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- 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/cache@v2
|
||||
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
|
Loading…
Reference in New Issue
Block a user