def _upload_artifacts(self, bucket):
mimetypes.add_type('application/json', '.map')
mimetypes.add_type('application/woff2', '.woff2')
for artifact in recursive_glob(self.config.path, '*'):
mime_type = mimetypes.guess_type(artifact)
if mime_type is None:
logger.error('Unknown mime type for %s', artifact)
sys.exit(1)
[content_type, _] = mime_type
if content_type is None:
logger.error('Unknown content-type for %s', artifact)
sys.exit(1)
logger.debug('Uploading %s [%s]', artifact, content_type)
file_path = artifact.replace('{}/'.format(self.config.path), '')
bucket.upload_file(artifact, file_path, ExtraArgs={
'ACL': 'public-read',
'CacheControl': 'public, max-age=31536000, no-cache',
'ContentType': content_type
})
评论列表
文章目录