You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
Upload CI builds to telegram
This commit is contained in:
22
.github/scripts/telegram_url.py
vendored
Normal file
22
.github/scripts/telegram_url.py
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import json
|
||||||
|
import os
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
|
url = f'https://api.telegram.org/bot{os.environ["BOT_TOKEN"]}'
|
||||||
|
url += f'/sendMediaGroup?chat_id={urllib.parse.quote(os.environ["CHANNEL_ID"])}&media='
|
||||||
|
|
||||||
|
msg = os.environ["COMMIT_MESSAGE"]
|
||||||
|
commit_url = os.environ["COMMIT_URL"]
|
||||||
|
commit_id = os.environ["COMMIT_ID"][:7]
|
||||||
|
|
||||||
|
caption = f"[{commit_id}]({commit_url})\n{msg}"[:1024]
|
||||||
|
|
||||||
|
data = json.dumps([
|
||||||
|
{"type": "document", "media": "attach://Release"},
|
||||||
|
{"type": "document", "media":"attach://Debug"},
|
||||||
|
{"type": "document", "media": "attach://ReleaseSymbol"},
|
||||||
|
{"type": "document", "media": "attach://DebugSymbol","caption": caption,"parse_mode":"MarkdownV2"}
|
||||||
|
])
|
||||||
|
|
||||||
|
url += urllib.parse.quote(data)
|
||||||
|
print(url)
|
||||||
30
.github/workflows/ci.yml
vendored
30
.github/workflows/ci.yml
vendored
@@ -2,6 +2,11 @@ name: CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
post_telegram:
|
||||||
|
description: 'Post to Telegram'
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
tags: [ v* ]
|
tags: [ v* ]
|
||||||
@@ -75,6 +80,12 @@ jobs:
|
|||||||
debugName=`ls module/build/outputs/release/Zygisk-Next-v*-debug.zip | awk -F '(/|.zip)' '{print $5}'` && echo "debugName=$debugName" >> $GITHUB_OUTPUT
|
debugName=`ls module/build/outputs/release/Zygisk-Next-v*-debug.zip | awk -F '(/|.zip)' '{print $5}'` && echo "debugName=$debugName" >> $GITHUB_OUTPUT
|
||||||
unzip module/build/outputs/release/Zygisk-Next-v*-release.zip -d zksu-release
|
unzip module/build/outputs/release/Zygisk-Next-v*-release.zip -d zksu-release
|
||||||
unzip module/build/outputs/release/Zygisk-Next-v*-debug.zip -d zksu-debug
|
unzip module/build/outputs/release/Zygisk-Next-v*-debug.zip -d zksu-debug
|
||||||
|
releaseSymbolName="$releaseName-symbols.zip"
|
||||||
|
debugSymbolName="$debugName-symbols.zip"
|
||||||
|
echo "releaseSymbolName=$releaseSymbolName" >> $GITHUB_OUTPUT
|
||||||
|
echo "debugSymbolName=$debugSymbolName" >> $GITHUB_OUTPUT
|
||||||
|
zip -r $releaseSymbolName zygiskd/build/symbols/release
|
||||||
|
zip -r $debugSymbolName zygiskd/build/symbols/debug
|
||||||
|
|
||||||
- name: Upload release
|
- name: Upload release
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -99,3 +110,22 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: ${{ steps.prepareArtifact.outputs.debugName }}-symbols
|
name: ${{ steps.prepareArtifact.outputs.debugName }}-symbols
|
||||||
path: "zygiskd/build/symbols/debug"
|
path: "zygiskd/build/symbols/debug"
|
||||||
|
|
||||||
|
- name: Post to channel
|
||||||
|
if: ${{ success() && github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.ref_type != 'tag' && inputs.post_telegram != 'false' }}
|
||||||
|
env:
|
||||||
|
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
|
||||||
|
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
|
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||||
|
COMMIT_URL: ${{ github.event.head_commit.url }}
|
||||||
|
COMMIT_ID: ${{ github.event.head_commit.id }}
|
||||||
|
run: |
|
||||||
|
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
|
||||||
|
OUTPUT="module/build/outputs/release"
|
||||||
|
export Release=$(find $OUTPUT -name "Zygisk-Next-v*-release.zip")
|
||||||
|
export Debug=$(find $OUTPUT -name "Zygisk-Next-v*-debug.zip")
|
||||||
|
export ReleaseSymbol="${{ steps.prepareArtifact.outputs.releaseSymbolName }}"
|
||||||
|
export DebugSymbol="${{ steps.prepareArtifact.outputs.debugSymbolName }}"
|
||||||
|
URL=$(python3 .github/scripts/telegram_url.py)
|
||||||
|
curl -v "$URL" -F Release="@$Release" -F Debug="@$Debug" -F ReleaseSymbol="@$ReleaseSymbol" -F DebugSymbol="@$DebugSymbol"
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user