From 0c873aa10b19556897833e7437150efd7395b77b Mon Sep 17 00:00:00 2001 From: XelXen <78258352+XelXen@users.noreply.github.com> Date: Wed, 21 Sep 2022 19:34:55 +0530 Subject: [PATCH 1/5] Add misc repo check for git uploads --- .github/uploader.py | 11 +++++++++++ .github/workflows/ci.yml | 13 +++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .github/uploader.py diff --git a/.github/uploader.py b/.github/uploader.py new file mode 100644 index 000000000..f0daaa339 --- /dev/null +++ b/.github/uploader.py @@ -0,0 +1,11 @@ +from os import system as run +import tgconfig + +if GH_REPO.lower() == "libre-tube/libretube": + run("git clone https://github.com/LibreTubeAlpha/Archive archive") + run("rm -rf archive/*.apk") + run("mv app/build/outputs/apk/debug/*.apk archive/") + run("cd archive") + run("git add -f *") + run('git commit -m "WORKFLOW: ALPHA BUILDS"') + run("git push -u") \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65597baf2..2359c23e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,13 +57,9 @@ jobs: - name: Upload to Archive continue-on-error: true 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 + mv .github/uploader.py . + echo "GH_REPO = '${{ github.repository }}'" > tgconfig.py + python uploader.py - name: Telegram Bot continue-on-error: true @@ -72,7 +68,8 @@ jobs: curl https://libre-tube.github.io/images/LibreAlpha.png --output alpha.png curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/exec --output bot-api chmod 755 ./bot-api - echo "TG_TOKEN = '${{ secrets.TG_TOKEN }}'" > tgconfig.py + mv ../tgconfig.py . + echo "TG_TOKEN = '${{ secrets.TG_TOKEN }}'" >> tgconfig.py echo "TG_API_ID = '${{ secrets.TG_API_ID }}'" >> tgconfig.py echo "TG_POST_ID = '${{ secrets.TG_POST_ID }}'" >> tgconfig.py echo "TG_API_HASH = '${{ secrets.TG_API_HASH }}'" >> tgconfig.py From 37e6595fd5acb3c119998bb9e70d4a93b1962bee Mon Sep 17 00:00:00 2001 From: XelXen <78258352+XelXen@users.noreply.github.com> Date: Wed, 21 Sep 2022 19:43:44 +0530 Subject: [PATCH 2/5] Fix actions syntax --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2359c23e5..26697258e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: continue-on-error: true run: | mv .github/uploader.py . - echo "GH_REPO = '${{ github.repository }}'" > tgconfig.py + echo "GH_REPO = '${{ env.GITHUB_REPOSITORY }}'" > tgconfig.py python uploader.py - name: Telegram Bot From 198cd5a54219441cd85fe5173bfdac1b7efd6430 Mon Sep 17 00:00:00 2001 From: XelXen <78258352+XelXen@users.noreply.github.com> Date: Wed, 21 Sep 2022 19:52:40 +0530 Subject: [PATCH 3/5] fix python syntax --- .github/uploader.py | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/uploader.py b/.github/uploader.py index f0daaa339..e6b2b924d 100644 --- a/.github/uploader.py +++ b/.github/uploader.py @@ -1,7 +1,7 @@ from os import system as run import tgconfig -if GH_REPO.lower() == "libre-tube/libretube": +if tgconfig.GH_REPO.lower() == "libre-tube/libretube": run("git clone https://github.com/LibreTubeAlpha/Archive archive") run("rm -rf archive/*.apk") run("mv app/build/outputs/apk/debug/*.apk archive/") diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26697258e..2359c23e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: continue-on-error: true run: | mv .github/uploader.py . - echo "GH_REPO = '${{ env.GITHUB_REPOSITORY }}'" > tgconfig.py + echo "GH_REPO = '${{ github.repository }}'" > tgconfig.py python uploader.py - name: Telegram Bot From 7ceb6054f788c24288a3bf8287df21338500475e Mon Sep 17 00:00:00 2001 From: XelXen <78258352+XelXen@users.noreply.github.com> Date: Thu, 22 Sep 2022 11:21:14 +0530 Subject: [PATCH 4/5] Fix Paths --- .github/uploader.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/uploader.py b/.github/uploader.py index e6b2b924d..a0cd08e12 100644 --- a/.github/uploader.py +++ b/.github/uploader.py @@ -8,4 +8,8 @@ if tgconfig.GH_REPO.lower() == "libre-tube/libretube": run("cd archive") run("git add -f *") run('git commit -m "WORKFLOW: ALPHA BUILDS"') - run("git push -u") \ No newline at end of file + run("git push -u") + run("cd ..") +else: + run("mkdir archive") + run("mv app/build/outputs/apk/debug/*.apk archive/") \ No newline at end of file From 8202df3e3753fcbd60cd246427ad43b3800c852c Mon Sep 17 00:00:00 2001 From: XelXen <78258352+XelXen@users.noreply.github.com> Date: Thu, 22 Sep 2022 11:26:44 +0530 Subject: [PATCH 5/5] Rename Worker [SILENT] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2359c23e5..789c5d348 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: distribution: "temurin" cache: "gradle" - - name: Prepare for Compilation + - name: Git Configuraion run: | git config --global user.name "alefvanoon" git config --global user.email "53198048+alefvanoon@users.noreply.github.com"