mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 11:05:59 +00:00
Merge pull request #44 from Minoricew/master
[Feat] <CI> Support Telegram automatic CI push
This commit is contained in:
57
.github/workflows/build.yml
vendored
57
.github/workflows/build.yml
vendored
@@ -7,9 +7,8 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
name: Build CI
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -29,13 +28,13 @@ jobs:
|
|||||||
- name: Upload Debug APK (testkey)
|
- name: Upload Debug APK (testkey)
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: OwnDroid-CI-${{ env.SHORT_SHA }}-debug-testkey.apk
|
name: OwnDroid-CI-${{ env.SHORT_SHA }}-debug-testkey
|
||||||
path: app/build/outputs/apk/debug/app-debug.apk
|
path: app/build/outputs/apk/debug/app-debug.apk
|
||||||
|
|
||||||
- name: Upload Release APK (testkey)
|
- name: Upload Release APK (testkey)
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: OwnDroid-CI-${{ env.SHORT_SHA }}-release-testkey.apk
|
name: OwnDroid-CI-${{ env.SHORT_SHA }}-release-testkey
|
||||||
path: app/build/outputs/apk/release/app-release.apk
|
path: app/build/outputs/apk/release/app-release.apk
|
||||||
|
|
||||||
- name: Export key
|
- name: Export key
|
||||||
@@ -53,11 +52,57 @@ jobs:
|
|||||||
- name: Upload Debug APK
|
- name: Upload Debug APK
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: OwnDroid-CI-${{ env.SHORT_SHA }}-debug-signed.apk
|
name: OwnDroid-CI-${{ env.SHORT_SHA }}-debug-signed
|
||||||
path: app/build/outputs/apk/debug/app-debug.apk
|
path: app/build/outputs/apk/debug/app-debug.apk
|
||||||
|
|
||||||
- name: Upload Release APK
|
- name: Upload Release APK
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: OwnDroid-CI-${{ env.SHORT_SHA }}-release-signed.apk
|
name: OwnDroid-CI-${{ env.SHORT_SHA }}-release-signed
|
||||||
path: app/build/outputs/apk/release/app-release.apk
|
path: app/build/outputs/apk/release/app-release.apk
|
||||||
|
|
||||||
|
upload-telegram:
|
||||||
|
name: Upload Builds
|
||||||
|
if: ${{ success() }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
steps:
|
||||||
|
- name: Download Artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
|
||||||
|
- name: Download telegram-bot-api-binary
|
||||||
|
run: |
|
||||||
|
mkdir ./binaries
|
||||||
|
wget "https://github.com/jakbin/telegram-bot-api-binary/releases/download/latest/telegram-bot-api" -O ./binaries/telegram-bot-api
|
||||||
|
chmod +x ./binaries/telegram-bot-api
|
||||||
|
|
||||||
|
- name: Start API Server & Upload
|
||||||
|
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"])))'`
|
||||||
|
cd artifacts
|
||||||
|
export DEBUG_TEST_PWD=$(find . -name "*-debug-testkey*")
|
||||||
|
mv ./$DEBUG_TEST_PWD/app-debug.apk ./$DEBUG_TEST_PWD.apk && rm -rf ./$DEBUG_TEST_PWD
|
||||||
|
export RELEASE_TEST_PWD=$(find . -name "*release-testkey*")
|
||||||
|
mv ./$RELEASE_TEST_PWD/app-release.apk ./$RELEASE_TEST_PWD.apk && rm -rf ./$RELEASE_TEST_PWD
|
||||||
|
export DEBUG_SIGNED_PWD=$(find . -name "*-debug-signed*")
|
||||||
|
mv ./$DEBUG_SIGNED_PWD/app-debug.apk ./$DEBUG_SIGNED_PWD.apk && rm -rf ./$DEBUG_SIGNED_PWD
|
||||||
|
export RELEASE_SIGNED_PWD=$(find . -name "*release-signed*")
|
||||||
|
mv ./$RELEASE_SIGNED_PWD/app-release.apk ./$RELEASE_SIGNED_PWD.apk && rm -rf ./$RELEASE_SIGNED_PWD
|
||||||
|
../binaries/telegram-bot-api --api-id=${{ secrets.TELEGRAM_API_APP_ID }} --api-hash=${{ secrets.TELEGRAM_API_HASH }} --local 2>&1 > /dev/null &
|
||||||
|
export token=${{ secrets.TELEGRAM_BOT_KEY }}
|
||||||
|
curl -v "http://127.0.0.1:8081/bot$token/sendMediaGroup?chat_id=-1002216379163&media=%5B%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FdebugTest%22%7D%2C%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseTest%22%7D%2C%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FdebugSigned%22%7D%2C%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseSigned%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22%3A${ESCAPED}%7D%5D" \
|
||||||
|
-F debugTest="@$DEBUG_TEST_PWD.apk" \
|
||||||
|
-F releaseTest="@$RELEASE_TEST_PWD.apk" \
|
||||||
|
-F debugSigned="@$DEBUG_SIGNED_PWD.apk" \
|
||||||
|
-F releaseSigned="@$RELEASE_SIGNED_PWD.apk"
|
||||||
|
|||||||
Reference in New Issue
Block a user