diff --git a/.github/workflows/build-apk.yml b/.github/workflows/build-apk.yml
index 1cd7aa9..30b73de 100644
--- a/.github/workflows/build-apk.yml
+++ b/.github/workflows/build-apk.yml
@@ -88,6 +88,10 @@ on:
description: 'Run the build with tmate debugging enabled.'
required: false
default: false
+ PREFERRED_PATCH_APPS:
+ description: "Apps to be patched. Overrides any env set"
+ required: false
+ type: string
concurrency:
group: ${{ github.head_ref || github.run_id }}
@@ -98,6 +102,7 @@ jobs:
with:
COMMIT_CHANGELOG: ${{ inputs.COMMIT_CHANGELOG }}
DEBUG_ENABLED: ${{ inputs.DEBUG_ENABLED }}
+ PREFERRED_PATCH_APPS: ${{ inputs.PREFERRED_PATCH_APPS }}
secrets:
ENVS: ${{ secrets.ENVS }}
REDDIT_CLIENT_ID: ${{ secrets.REDDIT_CLIENT_ID }}
diff --git a/.github/workflows/build-artifact.yml b/.github/workflows/build-artifact.yml
index 2898cb1..6b66073 100644
--- a/.github/workflows/build-artifact.yml
+++ b/.github/workflows/build-artifact.yml
@@ -24,6 +24,10 @@ on:
description: 'Run the build with tmate debugging enabled.'
required: false
default: false
+ PREFERRED_PATCH_APPS:
+ description: "Apps to be patched. Overrides any env set"
+ required: false
+ type: string
jobs:
build-apk:
@@ -40,6 +44,20 @@ jobs:
run: |
echo "${{ secrets.ENVS }}" >> .env
+ - name: Install Dot-Env
+ if: ${{ inputs.PREFERRED_PATCH_APPS }}
+ env:
+ PREFERRED_PATCH_APPS: ${{ inputs.PREFERRED_PATCH_APPS }}
+ run: |
+ pip install python-dotenv
+ pip install loguru
+
+ - name: Override Patch apps
+ if: ${{ inputs.PREFERRED_PATCH_APPS }}
+ env:
+ PREFERRED_PATCH_APPS: ${{ inputs.PREFERRED_PATCH_APPS }}
+ run: |
+ python -m scripts.prefered_apps
- name: Inject Reddit Client ID
env:
diff --git a/README.md b/README.md
index 541f42a..6af23b9 100644
--- a/README.md
+++ b/README.md
@@ -259,6 +259,8 @@ You can use any of the following methods to build.
```ini
PATCH_APPS=youtube,twitter,reddit
```
+ Tip - If for some reason you want to patch app but want to go through all this .env while running you can enter app
+ name in 
to be patched box.
5. If APKMirror or other apk sources are blocked in your region or script
somehow is unable to download from apkmirror. You can download apk manually from any source. Place them in
`/apks` directory and provide environment variable in `.env` file or in `ENVS` in `GitHub secrets`(Recommended)
diff --git a/requirements.txt b/requirements.txt
index fe46b6c..a12b190 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,6 +6,7 @@ lastversion==3.5.2
loguru==0.7.2
packaging==24.0
pre-commit==3.7.0
+python-dotenv==1.0.1
pytz==2024.1
requests==2.31.0
tqdm==4.66.2
diff --git a/scripts/prefered_apps.py b/scripts/prefered_apps.py
new file mode 100644
index 0000000..48c603e
--- /dev/null
+++ b/scripts/prefered_apps.py
@@ -0,0 +1,23 @@
+"""Update preferred apps."""
+
+import os
+
+import dotenv
+from loguru import logger
+
+
+def update_patch_apps() -> None:
+ """Update preferred apps."""
+ dotenv_file = dotenv.find_dotenv()
+ dotenv.load_dotenv(dotenv_file)
+ patch_apps = os.environ["PATCH_APPS"]
+ logger.info(f"PATCH_APPS is currently {patch_apps}")
+ os.environ["PATCH_APPS"] = os.environ["PREFERRED_PATCH_APPS"]
+ new_patch_apps = os.environ["PATCH_APPS"]
+ logger.info(f"PATCH_APPS is now {new_patch_apps}")
+
+ dotenv.set_key(dotenv_file, "PATCH_APPS", os.environ["PATCH_APPS"])
+
+
+if __name__ == "__main__":
+ update_patch_apps()