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
|
@ -180,11 +180,7 @@ function uploadNodeShasums () {
|
||||||
function uploadIndexJson () {
|
function uploadIndexJson () {
|
||||||
console.log('Uploading index.json to S3.')
|
console.log('Uploading index.json to S3.')
|
||||||
let scriptPath = path.join(__dirname, 'upload-index-json.py')
|
let scriptPath = path.join(__dirname, 'upload-index-json.py')
|
||||||
let scriptArgs = []
|
runScript(scriptPath, [pkgVersion])
|
||||||
if (args.automaticRelease) {
|
|
||||||
scriptArgs.push('-R')
|
|
||||||
}
|
|
||||||
runScript(scriptPath, scriptArgs)
|
|
||||||
console.log(`${pass} Done uploading index.json to S3.`)
|
console.log(`${pass} Done uploading index.json to S3.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,9 +271,7 @@ async function makeRelease (releaseToValidate) {
|
||||||
checkVersion()
|
checkVersion()
|
||||||
let draftRelease = await getDraftRelease()
|
let draftRelease = await getDraftRelease()
|
||||||
uploadNodeShasums()
|
uploadNodeShasums()
|
||||||
|
uploadIndexJson()
|
||||||
// FIXME(codebytere): re-enable later
|
|
||||||
if (process.env.UPLOAD_INDEX_JSON) uploadIndexJson()
|
|
||||||
|
|
||||||
await createReleaseShasums(draftRelease)
|
await createReleaseShasums(draftRelease)
|
||||||
// Fetch latest version of release before verifying
|
// Fetch latest version of release before verifying
|
||||||
|
|
|
@ -2,32 +2,38 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import urllib2
|
||||||
|
|
||||||
from lib.config import PLATFORM, s3_config
|
from lib.config import s3_config
|
||||||
from lib.util import electron_gyp, execute, s3put, scoped_cwd
|
from lib.util import s3put, scoped_cwd, safe_mkdir
|
||||||
|
|
||||||
|
|
||||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||||
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'D')
|
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'D')
|
||||||
|
|
||||||
PROJECT_NAME = electron_gyp()['project_name%']
|
BASE_URL = 'https://electron-metadumper.herokuapp.com/?version=v'
|
||||||
PRODUCT_NAME = electron_gyp()['product_name%']
|
|
||||||
|
|
||||||
|
version = sys.argv[1]
|
||||||
|
authToken = os.getenv('META_DUMPER_AUTH_HEADER')
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
if not authToken or authToken == "":
|
||||||
|
raise Exception("Please set META_DUMPER_AUTH_HEADER")
|
||||||
# Upload the index.json.
|
# Upload the index.json.
|
||||||
with scoped_cwd(SOURCE_ROOT):
|
with scoped_cwd(SOURCE_ROOT):
|
||||||
if sys.platform == 'darwin':
|
safe_mkdir(OUT_DIR)
|
||||||
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)
|
|
||||||
index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json'))
|
index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json'))
|
||||||
execute([electron,
|
|
||||||
os.path.join('tools', 'dump-version-info.js'),
|
request = urllib2.Request(
|
||||||
index_json])
|
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()
|
bucket, access_key, secret_key = s3_config()
|
||||||
s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist',
|
s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue