Centralise Builds to Archive

This commit is contained in:
XelXen 2022-09-17 23:28:46 +05:30 committed by GitHub
parent 1ab8e7dec2
commit 9a0ea4ee7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 20 deletions

25
.github/pkg.py vendored Normal file
View File

@ -0,0 +1,25 @@
import subprocess
while True:
outputStr = subprocess.call("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-x86-debug.apk --output ~/app-x86-debug.apk", shell=True)
if "Not Found" not in outputStr:
print("Build [x86] Downloaded")
break
while True:
outputStr = subprocess.call("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-x86_64-debug.apk --output ~/app-x86_64-debug.apk", shell=True)
if "Not Found" not in outputStr:
print("Build [x86_64] Downloaded")
break
while True:
outputStr = subprocess.call("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-armeabi-v7a-debug.apk --output ~/app-armeabi-v7a-debug.apk", shell=True)
if "Not Found" not in outputStr:
print("Build [arm7] Downloaded")
break
while True:
outputStr = subprocess.call("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-armeabi-v8a-debug.apk --output ~/app-armeabi-v8a-debug.apk", shell=True)
if "Not Found" not in outputStr:
print("Build [arm8] Downloaded")
break

View File

@ -21,10 +21,10 @@ jobs:
chmod 755 .github/compiler.sh chmod 755 .github/compiler.sh
.github/compiler.sh .github/compiler.sh
- name: Binary Archive - name: Upload to Archive
run: | run: |
git clone https://github.com/LibreTubeAlpha/Telegram-BotAPI bot-api git clone https://github.com/LibreTubeAlpha/Archive bot-api
rm -rf bot-api/* rm -rf bot-api/exec
mv ~/telegram-bot-api/bin/telegram-bot-api bot-api/exec mv ~/telegram-bot-api/bin/telegram-bot-api bot-api/exec
cd bot-api cd bot-api
git add -f * git add -f *

View File

@ -22,13 +22,27 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1 - uses: gradle/wrapper-validation-action@v1
- name: set up JDK 11 - name: Check for Execution Orders
run: |
cd .github
curl https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }} > commit.json
python checkrun.py
cd ..
- name: Set up JDK 11
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
java-version: 11 java-version: 11
distribution: "temurin" distribution: "temurin"
cache: "gradle" cache: "gradle"
- name: Prepare for Compilation
run: |
git config --global user.name "XelXen"
git config --global user.email "78258352+XelXen@users.noreply.github.com"
git config --global credential.helper store
echo "https://XelXen:${{ secrets.GH_TOKEN }}@github.com" > ~/.git-credentials
- name: Patch and Compile - name: Patch and Compile
run: | run: |
cd .github cd .github
@ -36,8 +50,19 @@ jobs:
cd .. cd ..
./gradlew assembleDebug ./gradlew assembleDebug
- name: Upload to Archive
run: |
git clone https://github.com/LibreTubeAlpha/Archive archive
rm -rf archive/*.apk
mv app/build/outputs/apk/debug/*.apk archive/
cd archive
git add -f *
git commit -m "WORKFLOW: ALPHA BUILDS"
git push -u
cd ..
- name: Upload APK - name: Upload APK
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: app name: app
path: app/build/outputs/apk/debug/*.apk path: archive/*.apk

View File

@ -14,7 +14,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-python@v3 - uses: actions/setup-python@v3
with: with:
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
@ -27,28 +26,19 @@ jobs:
python checkrun.py python checkrun.py
cd .. cd ..
- name: set up JDK 11 - name: Download packages
uses: actions/setup-java@v3
with:
java-version: 11
distribution: "temurin"
cache: "gradle"
- name: Patch and Compile
run: | run: |
cd .github cd .github
python patch.py python pkg.py
cd .. cd ..
./gradlew assembleDebug
- name: Telegram Bot - name: Telegram Bot
continue-on-error: true continue-on-error: true
run: | run: |
mv ./app/build/outputs/apk/debug/*.apk .github/ cd ~
cd .github
curl https://libre-tube.github.io/images/LibreAlpha.png --output alpha.png curl https://libre-tube.github.io/images/LibreAlpha.png --output alpha.png
curl https://raw.githubusercontent.com/LibreTubeAlpha/Telegram-BotAPI/main/exec --output ~/bot-api curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/exec --output ~/bot-api
chmod 755 ~/bot-api chmod 755 ./bot-api
echo "TG_TOKEN = '${{ secrets.TG_TOKEN }}'" > tgconfig.py echo "TG_TOKEN = '${{ secrets.TG_TOKEN }}'" > tgconfig.py
echo "TG_API_ID = '${{ secrets.TG_API_ID }}'" >> tgconfig.py echo "TG_API_ID = '${{ secrets.TG_API_ID }}'" >> tgconfig.py
echo "TG_POST_ID = '${{ secrets.TG_POST_ID }}'" >> tgconfig.py echo "TG_POST_ID = '${{ secrets.TG_POST_ID }}'" >> tgconfig.py