Manager/CI: Add spoofed manager build (#570)

* manager: add script for randomizing pkg name

Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
Co-Authored-By: YC酱luyancib <luyancib@qq.com>

* manager: Update randomizer to avoid bug

Revert "manager: Update randomizer to avoid bug"

This reverts commit af9205e70a11db3e3d43bb34de880bbd6b4185b5.

manager: Update randomizer to avoid bug

* mamager: Update randomizer to fix error
fixed
> Task :app:compileReleaseAidl FAILED
ERROR: /home/runner/work/SukiSU-Ultra/SukiSU-Ultra/manager/app/src/main/aidl/org/knifhr/zako/IKsuInterface.aidl:7.1-10: IKsuInterface should be declared in a file called com/sukisu/zako/IKsuInterface.aidl

* manager:clean randomizer

* ci:add spoofed manager build with matrix

* 更新 build-manager.yml

* 更新 build-manager.yml

* fix

* Revert "更新 build-manager.yml"

This reverts commit da80e3f13a.

* ksubot: make MESSAGE_THREAD_ID optional

---------

Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
Co-authored-by: rifsxd <rifat.44.azad.rifs@gmail.com>
Co-authored-by: 5ec1cff <ewtqyqyewtqyqy@gmail.com>
This commit is contained in:
YC酱luyancib
2025-11-15 10:58:10 +08:00
committed by GitHub
parent 01ac06c3fd
commit 3cfc6d6a31
3 changed files with 69 additions and 11 deletions

View File

@@ -55,6 +55,9 @@ jobs:
build-manager:
needs: build-ksud
runs-on: ubuntu-latest
strategy:
matrix:
spoofed: ["true","false"]
defaults:
run:
working-directory: ./manager
@@ -74,6 +77,25 @@ jobs:
echo "UPLOAD=false" >> $GITHUB_OUTPUT
fi
- name: Determine manager variant for telegram bot
id: determine
run: |
if [ "${{ matrix.spoofed }}" == "true" ]; then
echo "title=Spoofed-Manager" >> $GITHUB_OUTPUT
# maybe need a new var
echo "topicid=519956" >> $GITHUB_OUTPUT
else
echo "title=Manager" >> $GITHUB_OUTPUT
echo "topicid=${{ vars.MESSAGE_THREAD_ID }}" >> $GITHUB_OUTPUT
fi
- name: Run randomizer
if: ${{ matrix.spoofed == 'true' }}
run: |
chmod +x randomizer
./randomizer
- name: Write key
if: ${{ ( github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' )) || github.ref_type == 'tag' }}
run: |
@@ -148,14 +170,14 @@ jobs:
uses: actions/upload-artifact@v4
if: ${{ ( github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' )) || github.ref_type == 'tag' }}
with:
name: manager
name: ${{ steps.determine.outputs.title }}
path: manager/app/build/outputs/apk/release/*.apk
- name: Upload mappings
uses: actions/upload-artifact@v4
if: ${{ ( github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' )) || github.ref_type == 'tag' }}
with:
name: "mappings"
name: "${{ steps.determine.outputs.title }}-mappings"
path: "manager/app/build/outputs/mapping/release/"
- name: Bot session cache
@@ -171,11 +193,11 @@ jobs:
env:
CHAT_ID: ${{ vars.CHAT_ID }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
MESSAGE_THREAD_ID: ${{ vars.MESSAGE_THREAD_ID }}
MESSAGE_THREAD_ID: ${{ steps.determine.outputs.topicid }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
COMMIT_URL: ${{ github.event.head_commit.url }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
TITLE: Manager
TITLE: ${{ steps.determine.outputs.title }}
BRANCH: ${{ github.ref_name }}
run: |
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then

31
manager/randomizer Normal file
View File

@@ -0,0 +1,31 @@
#! /usr/bin/env bash
# Generate 3 random lowercase words (6 letters each)
word1=$(tr -dc 'a-z' </dev/urandom | head -c6)
word2=$(tr -dc 'a-z' </dev/urandom | head -c6)
word3=$(tr -dc 'a-z' </dev/urandom | head -c6)
word4=$(tr -dc 'a-z' </dev/urandom | head -c6)
# Export variables for use in find -exec
export word1 word2 word3 word4
# Rename directories
find . -depth -type d -name 'com' -execdir mv {} "$word1" \;
find . -depth -type d -name 'sukisu' -execdir mv {} "$word2" \;
find . -depth -type d -name 'ultra' -execdir mv {} "$word3" \;
find . -depth -type d -name 'io' -execdir mv {} "$word4" \;
# Replace inside files
find . -type f -exec sed -i \
-e "s/com\.sukisu\.ultra/$word1.$word2.$word3/g" \
-e "s/io\.sukisu\.ultra/$word4.$word2.$word3/g" \
-e "s/com\.sukisu\.zako/$word1.$word2.zako/g" \
-e "s/com\/sukisu\/ultra/$word1\/$word2\/$word3/g" \
-e "s/io\/sukisu\/ultra/$word4\/$word2\/$word3/g" \
-e "s/io_sukisu_ultra/${word4}_${word2}_${word3}/g" \
-e "s/com_sukisu_ultra/${word1}_${word2}_${word3}/g" {} +
# add -spoofed on tags
sed -i -e '/fun getGitDescribe(): String {/,/^ }/ s/\.trim()$/.trim() + "-spoofed"/' build.gradle.kts

View File

@@ -2,7 +2,6 @@ import asyncio
import os
import sys
from telethon import TelegramClient
from telethon.tl.functions.help import GetConfigRequest
API_ID = 611335
API_HASH = "d524b414d21f4d37f08684c1df41ac9c"
@@ -52,7 +51,10 @@ def check_environ():
print("[-] Invalid CHAT_ID")
exit(1)
else:
try:
CHAT_ID = int(CHAT_ID)
except:
pass
if COMMIT_URL is None:
print("[-] Invalid COMMIT_URL")
exit(1)
@@ -71,11 +73,14 @@ def check_environ():
if BRANCH is None:
print("[-] Invalid BRANCH")
exit(1)
if MESSAGE_THREAD_ID is None:
if MESSAGE_THREAD_ID is None and MESSAGE_THREAD_ID != "":
try:
MESSAGE_THREAD_ID = int(MESSAGE_THREAD_ID)
except:
print("[-] Invaild MESSAGE_THREAD_ID")
exit(1)
else:
MESSAGE_THREAD_ID = int(MESSAGE_THREAD_ID)
MESSAGE_THREAD_ID = None
async def main():