Ability to override patch apps from GH UI

This commit is contained in:
Nikhil Badyal
2024-04-17 17:09:04 +05:30
committed by Nikhil Badyal
parent 11139217f8
commit e740cbb07a
5 changed files with 49 additions and 0 deletions
+5
View File
@@ -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 }}
+18
View File
@@ -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:
+2
View File
@@ -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 <img src="https://i.imgur.com/DwhBH9H.png" width="300" style="left"><br> to be patched box.
5. <a id="existing-downloaded-apks"></a>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)
+1
View File
@@ -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
+23
View File
@@ -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()