84 lines
2.7 KiB
Python
84 lines
2.7 KiB
Python
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-test/internal/'
|
|
|
|
BundleConfig = {
|
|
'6001': 'whot',
|
|
'6002': 'whot',
|
|
'6003': 'whot',
|
|
'6005': 'BRWhot',
|
|
'2001': 'roulette',
|
|
'2002': 'wajeSpin',
|
|
'2003': 'bottleSpin',
|
|
'2004': 'blackjack',
|
|
'2006': 'betterjack',
|
|
'6007': 'BRWhot',
|
|
'2008': 'slots',
|
|
'2005': 'christmas',
|
|
}
|
|
|
|
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):
|
|
print('remove path: ', 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)
|
|
|
|
# 上传src相共用文件
|
|
SrcDir = BuildDir + '\\src\\'
|
|
SrcDst = SubgamePath + 'lib/src/'
|
|
rmResult = subprocess.run(['cmd', '/c', 'aws s3 rm ' + SrcDst + ' --recursive'], capture_output=True, text=True)
|
|
print('remove dir src result: ', rmResult)
|
|
cmd = 'call aws s3 cp '+ SrcDir +' '+SrcDst + ' --recursive --region ap-east-1'
|
|
result = subprocess.run(['cmd', '/c', cmd], capture_output=True, text=True)
|
|
print('upload dir src result: ', result)
|
|
remove_folder(SrcDir)
|
|
|
|
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] +'/'
|
|
|
|
rmResult = subprocess.run(['cmd', '/c', 'aws s3 rm ' + awsPath + ' --recursive'], capture_output=True, text=True)
|
|
print('remove game gameid: ', gameid, ' result: ', rmResult)
|
|
|
|
subgameDir = BuildDir + 'assets\\' + BundleConfig[gameid] +'\\'
|
|
cmd = 'call aws s3 cp '+ subgameDir +' '+awsPath + ' --recursive --region ap-east-1'
|
|
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 ap-east-1'
|
|
result = subprocess.run(['cmd', '/c', cmd], capture_output=True, text=True)
|
|
print('upload game gameid: ', gameid, ' result: ', result) |