-
Notifications
You must be signed in to change notification settings - Fork 107
feat: local dev environment deploy config for VSCode #7798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
582067c
117bed1
f19e4a4
17b2805
b5bec7d
0b5c61d
2b8e348
6f73b6d
cb1db8c
8ab9775
e4babe5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| WIKI_BASE_URL=https://liquipedia.net | ||
| WIKI_UA_EMAIL=john.doe@liquipedia.is.awesome | ||
| WIKI_USER=YourBotAccount@BotName | ||
| WIKI_PASSWORD=YourBotPassword | ||
| DRY_RUN=0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "label": "Deploy current file", | ||
| "type": "shell", | ||
| "command": "${command:python.interpreterPath}", | ||
| "args": [ | ||
| "scripts${/}deploy.py", | ||
| "${relativeFile}" | ||
| ], | ||
| "options": { | ||
| "env": { | ||
| "LUA_DEV_ENV_NAME": "/dev/${input:devEnvironment}", | ||
| "LUA_DEV_BASE_REF": "${input:devBaseRef}" | ||
| } | ||
| }, | ||
| "problemMatcher": [] | ||
| }, | ||
| { | ||
| "label": "Deploy all changed file", | ||
| "type": "shell", | ||
| "command": "${command:python.interpreterPath}", | ||
| "args": [ | ||
| "scripts${/}deploy.py", | ||
| ], | ||
| "options": { | ||
| "env": { | ||
| "LUA_DEV_ENV_NAME": "/dev/${input:devEnvironment}", | ||
| "LUA_DEV_BASE_REF": "${input:devBaseRef}" | ||
| } | ||
| }, | ||
| "problemMatcher": [] | ||
| } | ||
| ], | ||
| "inputs": [ | ||
| { | ||
| "id": "devEnvironment", | ||
| "type": "promptString", | ||
| "description": "Lua Dev Enviroment name" | ||
| }, | ||
| { | ||
| "id": "devBaseRef", | ||
| "type": "promptString", | ||
| "description": "Base ref to compare against for dev deployment", | ||
| "default": "main" | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| requests==2.34.2 | ||
| python-dotenv==1.2.2 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,17 +2,22 @@ | |
| import os | ||
| import pathlib | ||
| import re | ||
| import subprocess | ||
| import sys | ||
|
|
||
| from typing import Iterable | ||
|
|
||
| from dotenv import load_dotenv | ||
|
|
||
| from deploy_util import ( | ||
| get_git_deploy_reason, | ||
| read_file_from_path, | ||
| write_to_github_summary_file, | ||
| ) | ||
| from mediawiki_session import MediaWikiSession | ||
|
|
||
| load_dotenv() | ||
|
|
||
| HEADER_PATTERN = re.compile( | ||
| r"\A---\n" r"-- @Liquipedia\n" r"-- page=(?P<pageName>[^\n]*)\n" | ||
| ) | ||
|
|
@@ -46,11 +51,33 @@ def main(): | |
| all_modules_deployed = True | ||
| lua_files: Iterable[pathlib.Path] | ||
| git_deploy_reason: str | ||
| if len(sys.argv[1:]) == 0: | ||
| assert os.getenv("LUA_DEV_ENV_NAME") is None or ( | ||
| os.getenv("LUA_DEV_ENV_NAME") != "/dev/" | ||
| and os.getenv("LUA_DEV_ENV_NAME").startswith("/dev/") | ||
| ), f"Invalid dev environment: {os.getenv('LUA_DEV_ENV_NAME')}" | ||
| if len(sys.argv[1:]) == 0 and os.getenv("LUA_DEV_ENV_NAME") is None: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to further guard this path?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe having a prefix check won't hurt much now that I think about it...
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was rather thinking about someone forgetting to set the environment variable.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
vscode will always prompt for a dev env name so I don't think extra check is needed and anyone using non-admin bot will face MW yelling anyway |
||
| lua_files = pathlib.Path("./lua/wikis/").rglob("*.lua") | ||
| git_deploy_reason = "Automated Weekly Re-Sync" | ||
| else: | ||
| lua_files = [pathlib.Path(arg) for arg in sys.argv[1:]] | ||
| if len(sys.argv[1:]) == 0: | ||
| lua_files = [ | ||
| pathlib.Path(changed_file) | ||
| for changed_file in subprocess.check_output( | ||
| [ | ||
| "git", | ||
| "diff", | ||
| "--name-only", | ||
| "--diff-filter=d", | ||
| os.getenv("LUA_DEV_BASE_REF") or "main", | ||
| "lua/wikis/*", | ||
| ] | ||
| ) | ||
| .decode() | ||
| .strip() | ||
| .splitlines() | ||
| ] | ||
| else: | ||
| lua_files = [pathlib.Path(arg) for arg in sys.argv[1:]] | ||
| git_deploy_reason = get_git_deploy_reason() | ||
|
|
||
| for wiki, files in itertools.groupby(sorted(lua_files), lambda path: path.parts[2]): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.