Skip to content

Commit

Permalink
prepare for actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve-Mr committed Sep 25, 2024
1 parent c66b5f5 commit 2fc2b08
Show file tree
Hide file tree
Showing 5 changed files with 503 additions and 5 deletions.
52 changes: 52 additions & 0 deletions .github/scripts/upload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import json
import os
import requests

apiAddress = "http://127.0.0.1:8081/"
urlPrefix = apiAddress + "bot" + os.getenv("TELEGRAM_TOKEN")


def findString(sourceStr, targetStr):
if str(sourceStr).find(str(targetStr)) == -1:
return False
else:
return True


def genFileDirectory(path):
files_walk = os.walk(path)
target = {
}
for root, dirs, file_name_dic in files_walk:
for fileName in file_name_dic:
if findString(fileName, "v8a"):
target["arm64"] = (fileName, open(path + "/" + fileName, "rb"))
if findString(fileName, "v7a"):
target["armeabi"] = (fileName, open(path + "/" + fileName, "rb"))
if findString(fileName, "x86.apk"):
target["i386"] = (fileName, open(path + "/" + fileName, "rb"))
if findString(fileName, "x86_64"):
target["amd64"] = (fileName, open(path + "/" + fileName, "rb"))

return target


def sendDocument(user_id, path, message = "", entities = None):
files = {'document': open(path, 'rb')}
data = {'chat_id': user_id,
'caption': message,
'parse_mode': 'Markdown',
'caption_entities': entities}
response = requests.post(urlPrefix + "/sendDocument", files=files, data=data)
print(response.json())


def sendAPKs(path):
apks = os.listdir("apks")
apks.sort()
apk = os.path.join("apks", apks[0])
sendDocument(user_id="@maaryIsTyping", path = apk, message="#app #apk #wallpaperTunnel https://github.com/Steve-Mr/WallpaperTunnel")

if __name__ == '__main__':
sendAPKs("./apks")

10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: WallpaperTunnel-arm64-v8a.apk
asset_name: Oblivionis-arm64-v8a.apk
asset_path: ${{ env.APK_FILE }}
asset_content_type: application/zip

Expand All @@ -97,7 +97,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: WallpaperTunnel-armeabi-v7a.apk
asset_name: Oblivionis-armeabi-v7a.apk
asset_path: ${{ env.APK_FILE_ARMV7 }}
asset_content_type: application/zip

Expand All @@ -107,7 +107,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: WallpaperTunnel-x86_64.apk
asset_name: Oblivionis-x86_64.apk
asset_path: ${{ env.APK_FILE_X64 }}
asset_content_type: application/zip

Expand All @@ -117,7 +117,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: WallpaperTunnel-x86.apk
asset_name: Oblivionis-x86.apk
asset_path: ${{ env.APK_FILE_X86 }}
asset_content_type: application/zip

Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
run: |
chmod +x telegram-bot-api-binary
./telegram-bot-api-binary --api-id=21724 --api-hash=3e0cb5efcd52300aec5994fdfc5bdc16 --local 2>&1 > /dev/null &
curl https://raw.githubusercontent.com/Steve-Mr/WallpaperTunnel/master/.github/scripts/upload.py -o uploadCI.py
curl https://raw.githubusercontent.com/Steve-Mr/Oblivionis/master/.github/scripts/upload.py -o uploadCI.py
python uploadCI.py > upload.txt
cat upload.txt
env:
Expand Down
123 changes: 123 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2fc2b08

Please sign in to comment.