chore: use metadumper service to create index.json file (#14158)
This commit is contained in:
parent
8b6072b411
commit
59d6c1e063
2 changed files with 23 additions and 23 deletions
|
@ -2,32 +2,38 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
from lib.config import PLATFORM, s3_config
|
||||
from lib.util import electron_gyp, execute, s3put, scoped_cwd
|
||||
|
||||
from lib.config import s3_config
|
||||
from lib.util import s3put, scoped_cwd, safe_mkdir
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'D')
|
||||
|
||||
PROJECT_NAME = electron_gyp()['project_name%']
|
||||
PRODUCT_NAME = electron_gyp()['product_name%']
|
||||
BASE_URL = 'https://electron-metadumper.herokuapp.com/?version=v'
|
||||
|
||||
version = sys.argv[1]
|
||||
authToken = os.getenv('META_DUMPER_AUTH_HEADER')
|
||||
|
||||
def main():
|
||||
if not authToken or authToken == "":
|
||||
raise Exception("Please set META_DUMPER_AUTH_HEADER")
|
||||
# Upload the index.json.
|
||||
with scoped_cwd(SOURCE_ROOT):
|
||||
if sys.platform == 'darwin':
|
||||
electron = os.path.join(OUT_DIR, '{0}.app'.format(PRODUCT_NAME),
|
||||
'Contents', 'MacOS', PRODUCT_NAME)
|
||||
elif sys.platform == 'win32':
|
||||
electron = os.path.join(OUT_DIR, '{0}.exe'.format(PROJECT_NAME))
|
||||
else:
|
||||
electron = os.path.join(OUT_DIR, PROJECT_NAME)
|
||||
safe_mkdir(OUT_DIR)
|
||||
index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json'))
|
||||
execute([electron,
|
||||
os.path.join('tools', 'dump-version-info.js'),
|
||||
index_json])
|
||||
|
||||
request = urllib2.Request(
|
||||
BASE_URL + version,
|
||||
headers={"Authorization" : authToken}
|
||||
)
|
||||
|
||||
new_content = urllib2.urlopen(
|
||||
request
|
||||
).read()
|
||||
|
||||
with open(index_json, "w") as f:
|
||||
f.write(new_content)
|
||||
|
||||
bucket, access_key, secret_key = s3_config()
|
||||
s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue