Save the latest version when uploading distribution.
This commit is contained in:
parent
1a2637e2cc
commit
fc4dd0aecb
2 changed files with 27 additions and 10 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
atom-shell.zip
|
atom-shell.zip
|
||||||
|
version
|
||||||
build/
|
build/
|
||||||
dist/
|
dist/
|
||||||
node/
|
node/
|
||||||
|
|
|
@ -4,6 +4,7 @@ import errno
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||||
|
@ -32,17 +33,9 @@ def upload():
|
||||||
bucket, access_key, secret_key = s3_config()
|
bucket, access_key, secret_key = s3_config()
|
||||||
commit = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
|
commit = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
|
||||||
|
|
||||||
args = [
|
s3put(bucket, access_key, secret_key, 'atom-shell/{0}'.format(commit), glob.glob('atom-shell*.zip'))
|
||||||
's3put',
|
|
||||||
'--bucket', bucket,
|
|
||||||
'--access_key', access_key,
|
|
||||||
'--secret_key', secret_key,
|
|
||||||
'--prefix', SOURCE_ROOT,
|
|
||||||
'--key_prefix', 'atom-shell/{0}'.format(commit),
|
|
||||||
'--grant', 'public-read'
|
|
||||||
] + glob.glob('atom-shell*.zip')
|
|
||||||
|
|
||||||
subprocess.check_call(args)
|
update_version(bucket, access_key, secret_key, commit)
|
||||||
|
|
||||||
|
|
||||||
def s3_config():
|
def s3_config():
|
||||||
|
@ -56,6 +49,29 @@ def s3_config():
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
def update_version(bucket, access_key, secret_key, commit):
|
||||||
|
version_path = os.path.join(SOURCE_ROOT, 'version')
|
||||||
|
with open(version_path, 'w') as version_file:
|
||||||
|
version_file.write(commit)
|
||||||
|
|
||||||
|
# Upload after file is closed, it's required under Windows.
|
||||||
|
s3put(bucket, access_key, secret_key, 'atom-shell', [ version_path ])
|
||||||
|
|
||||||
|
|
||||||
|
def s3put(bucket, access_key, secret_key, key_prefix, files):
|
||||||
|
args = [
|
||||||
|
's3put',
|
||||||
|
'--bucket', bucket,
|
||||||
|
'--access_key', access_key,
|
||||||
|
'--secret_key', secret_key,
|
||||||
|
'--prefix', SOURCE_ROOT,
|
||||||
|
'--key_prefix', key_prefix,
|
||||||
|
'--grant', 'public-read'
|
||||||
|
] + files
|
||||||
|
|
||||||
|
subprocess.check_call(args)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue