From c66b5f566331694956c4c36ff17bdd19363f168b Mon Sep 17 00:00:00 2001
From: Maary <24504742+Steve-Mr@users.noreply.github.com>
Date: Wed, 25 Sep 2024 22:33:45 +0800
Subject: [PATCH 1/4] Create main.yml
---
.github/workflows/main.yml | 202 +++++++++++++++++++++++++++++++++++++
1 file changed, 202 insertions(+)
create mode 100644 .github/workflows/main.yml
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..0db688e
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,202 @@
+name: Android CI
+
+on:
+ pull_request:
+ branches: [ "master" ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: set up JDK 17
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+ cache: gradle
+
+ - name: Storing key.properties
+ run: |
+ echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > ./key.properties
+ ls ./
+ ls -l key.properties
+
+ - name: Storing keystore
+ run: |
+ echo "${{ secrets.KEYSTORE }}" | base64 --decode > ./app/key.keystore
+ ls ./app
+ ls -l ./app/key.keystore
+
+ - name: Storing keystore
+ run: |
+ echo "${{ secrets.KEYSTORE }}" | base64 --decode > ./key.keystore
+ ls -l ./key.keystore
+
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+ - name: Build with Gradle
+ run: |
+ ./gradlew :app:assembleRelease
+
+ echo "APK_FILE=$(find app/build/outputs/apk -name '*arm64*.apk')" >> $GITHUB_ENV
+ echo "APK_FILE_ARMV7=$(find app/build/outputs/apk -name '*v7a*.apk')" >> $GITHUB_ENV
+ echo "APK_FILE_X86=$(find app/build/outputs/apk -name '*x86\-*.apk')" >> $GITHUB_ENV
+ echo "APK_FILE_X64=$(find app/build/outputs/apk -name '*x86\_64*.apk')" >> $GITHUB_ENV
+
+ - uses: actions/upload-artifact@v2
+ name: Upload apk (arm64-v8a)
+ with:
+ name: app-arm64-v8a-release
+ path: ${{ env.APK_FILE }}
+ - uses: actions/upload-artifact@v2
+ name: Upload apk (armeabi-v7a)
+ with:
+ name: app-armeabi-v7a-release
+ path: ${{ env.APK_FILE_ARMV7 }}
+ - uses: actions/upload-artifact@v2
+ name: Upload apk (x86_64)
+ with:
+ name: app-x86_64-release
+ path: ${{ env.APK_FILE_X64 }}
+ - uses: actions/upload-artifact@v2
+ name: Upload apk (x86)
+ with:
+ name: app-x86-release
+ path: ${{ env.APK_FILE_X86 }}
+
+ - name: Create Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+ with:
+ tag_name: v${{ github.run_number }}
+ prerelease: true
+ release_name: Release v${{ github.run_number }}
+ body: |
+ ## Changes
+ ${{ github.event.pull_request.body }}
+ ${{ steps.show_pr_commits.outputs.commits }}
+
+ - uses: actions/upload-release-asset@v1
+ name: Upload apk (arm64-v8a)
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_name: WallpaperTunnel-arm64-v8a.apk
+ asset_path: ${{ env.APK_FILE }}
+ asset_content_type: application/zip
+
+ - uses: actions/upload-release-asset@v1
+ name: Upload apk (armeabi-v7a)
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_name: WallpaperTunnel-armeabi-v7a.apk
+ asset_path: ${{ env.APK_FILE_ARMV7 }}
+ asset_content_type: application/zip
+
+ - uses: actions/upload-release-asset@v1
+ name: Upload apk (x86_64)
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_name: WallpaperTunnel-x86_64.apk
+ asset_path: ${{ env.APK_FILE_X64 }}
+ asset_content_type: application/zip
+
+ - uses: actions/upload-release-asset@v1
+ name: Upload apk (x86)
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_name: WallpaperTunnel-x86.apk
+ asset_path: ${{ env.APK_FILE_X86 }}
+ asset_content_type: application/zip
+
+
+ upload:
+ name: Upload Release
+ runs-on: ubuntu-latest
+ needs:
+ - build
+ - telegram-bot-api
+ steps:
+ - name: Download 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: find apk
+ run: |
+ mkdir apks
+ find artifacts -name "*.apk" -exec cp {} apks \;
+ echo "APK_FILE_UPLOAD=$(find apks -name '*arm64*.apk')" >> $GITHUB_ENV
+ ls ./apks
+
+ - name: Get Apk Info
+ id: apk
+ uses: JantHsueh/get-apk-info-action@master
+ with:
+ apkPath: ${{ env.APK_FILE_UPLOAD }}
+
+ - name: Release
+ 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
+ python uploadCI.py > upload.txt
+ cat upload.txt
+ env:
+ TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
+ VERSION_CODE: ${{steps.apk.outputs.versionCode}}
+ VERSION_NAME: ${{steps.apk.outputs.versionNum}}
+ COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
+
+ 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
From 2fc2b08879bb8f7cbfb1e07aa7608dd0dd58c2d1 Mon Sep 17 00:00:00 2001
From: Maary <24504742+Steve-Mr@users.noreply.github.com>
Date: Wed, 25 Sep 2024 22:48:01 +0800
Subject: [PATCH 2/4] prepare for actions
---
.github/scripts/upload.py | 52 +++++
.github/workflows/main.yml | 10 +-
.idea/codeStyles/Project.xml | 123 +++++++++++
.idea/codeStyles/codeStyleConfig.xml | 5 +
.idea/other.xml | 318 +++++++++++++++++++++++++++
5 files changed, 503 insertions(+), 5 deletions(-)
create mode 100644 .github/scripts/upload.py
create mode 100644 .idea/codeStyles/Project.xml
create mode 100644 .idea/codeStyles/codeStyleConfig.xml
create mode 100644 .idea/other.xml
diff --git a/.github/scripts/upload.py b/.github/scripts/upload.py
new file mode 100644
index 0000000..ebea6d0
--- /dev/null
+++ b/.github/scripts/upload.py
@@ -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")
+
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 0db688e..35fed4c 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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:
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..7643783
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..79ee123
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/other.xml b/.idea/other.xml
new file mode 100644
index 0000000..94c96f6
--- /dev/null
+++ b/.idea/other.xml
@@ -0,0 +1,318 @@
+
+
+
+
+
+
\ No newline at end of file
From 961c9014e73e62cc5ea629fafacaf15f61779f3d Mon Sep 17 00:00:00 2001
From: Maary <24504742+Steve-Mr@users.noreply.github.com>
Date: Wed, 25 Sep 2024 22:52:28 +0800
Subject: [PATCH 3/4] uploadv2 -> v4
---
.github/workflows/main.yml | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 35fed4c..2ccbe19 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -46,22 +46,22 @@ jobs:
echo "APK_FILE_X86=$(find app/build/outputs/apk -name '*x86\-*.apk')" >> $GITHUB_ENV
echo "APK_FILE_X64=$(find app/build/outputs/apk -name '*x86\_64*.apk')" >> $GITHUB_ENV
- - uses: actions/upload-artifact@v2
+ - uses: actions/upload-artifact@v4
name: Upload apk (arm64-v8a)
with:
name: app-arm64-v8a-release
path: ${{ env.APK_FILE }}
- - uses: actions/upload-artifact@v2
+ - uses: actions/upload-artifact@v4
name: Upload apk (armeabi-v7a)
with:
name: app-armeabi-v7a-release
path: ${{ env.APK_FILE_ARMV7 }}
- - uses: actions/upload-artifact@v2
+ - uses: actions/upload-artifact@v4
name: Upload apk (x86_64)
with:
name: app-x86_64-release
path: ${{ env.APK_FILE_X64 }}
- - uses: actions/upload-artifact@v2
+ - uses: actions/upload-artifact@v4
name: Upload apk (x86)
with:
name: app-x86-release
@@ -130,7 +130,7 @@ jobs:
- telegram-bot-api
steps:
- name: Download Artifacts
- uses: actions/download-artifact@v2
+ uses: actions/download-artifact@v4
with:
path: artifacts
- name: Download Telegram Bot API Binary
@@ -170,14 +170,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- 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
+ uses: actions/cache@v4
with:
path: telegram-bot-api-binary
key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }}
From 55d84720fe485e7eea99fa1f25768a88baafd510 Mon Sep 17 00:00:00 2001
From: Maary <24504742+Steve-Mr@users.noreply.github.com>
Date: Wed, 25 Sep 2024 22:54:02 +0800
Subject: [PATCH 4/4] change upload.py path in main.yml
---
.github/workflows/main.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 2ccbe19..d9e3c9d 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -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/Oblivionis/master/.github/scripts/upload.py -o uploadCI.py
+ curl https://raw.githubusercontent.com/Steve-Mr/Oblivionis/dev/.github/scripts/upload.py -o uploadCI.py
python uploadCI.py > upload.txt
cat upload.txt
env: