From f76b08ebf3f50716a5edf919b2623c1f888cc56b Mon Sep 17 00:00:00 2001 From: Kirito Date: Fri, 15 Aug 2025 10:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Epublish?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/switchBundleR.py | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 python/switchBundleR.py diff --git a/python/switchBundleR.py b/python/switchBundleR.py new file mode 100644 index 0000000..b471d5f --- /dev/null +++ b/python/switchBundleR.py @@ -0,0 +1,68 @@ +import os +import sys +import subprocess + +if len(sys.argv) < 3: + exit() +if '123!@#' != sys.argv[2]: + exit() + +ProjDir = sys.argv[1] +BuildDir = ProjDir + '\\build\\web-mobile\\' +SubgamePath = 's3://web-h5game-prod/internal/' + +BundleConfig = { + '6001': 'whot', + '6002': 'whot', + '6003': 'whot', + '6005': 'BRWhot', + '2001': 'roulette', + '2002': 'wajeSpin', + '2003': 'bottleSpin', + '2004': 'blackjack', + '2006': 'betterjack', + '6007': 'BRWhot', + '2008': 'slots', +} + +unlinkArray = [ + 'cocos2d-js.109f3.js', + 'cocos2d-js-min.13181.js', + 'physics.9d2de.js', + 'physics-min.ce5ee.js', + 'style-desktop.dfd76.css', + 'style-mobile.6e9cd.css', + 'splash.85cfd.png' +] + +def remove_folder(path): + if os.path.exists(path): + if os.path.isfile(path) or os.path.islink(path): + os.remove(path) + else: + for filename in os.listdir(path): + remove_folder(os.path.join(path, filename)) + os.rmdir(path) + +for filename in os.listdir(BuildDir): + file_path = os.path.join(BuildDir, filename) + if filename in unlinkArray: + os.remove(file_path) + +for gameid in BundleConfig: + awsPath = SubgamePath + gameid + '/assets/' + BundleConfig[gameid] +'/' + subgameDir = BuildDir + 'assets\\' + BundleConfig[gameid] +'\\' + cmd = 'call aws s3 cp '+ subgameDir +' '+awsPath + ' --recursive --region eu-west-3' + result = subprocess.run(['cmd', '/c', cmd], capture_output=True, text=True) + print(result) + +for gameid in BundleConfig: + awsPath = SubgamePath + gameid + '/assets/' + BundleConfig[gameid] +'/' + subgameDir = BuildDir + 'assets\\' + BundleConfig[gameid] + remove_folder(subgameDir) + +for gameid in BundleConfig: + awsPath = SubgamePath + gameid + '/' + cmd = 'call aws s3 cp '+ BuildDir +' '+awsPath + ' --recursive --region eu-west-3' + result = subprocess.run(['cmd', '/c', cmd], capture_output=True, text=True) + print(result) \ No newline at end of file