Change s3 key prefix

This commit is contained in:
Brad Davis 2019-12-03 12:06:51 -08:00
parent f39088fb0b
commit 8844620116
2 changed files with 5 additions and 3 deletions

View file

@ -107,7 +107,7 @@ jobs:
shell: bash
id: buildenv1
run: |
echo ::set-env name=UPLOAD_PREFIX::master/$RELEASE_NUMBER
echo ::set-env name=UPLOAD_PREFIX::master
echo ::set-env name=GIT_COMMIT_SHORT::`echo $GIT_COMMIT | cut -c1-7`
# Linux build variables
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then

View file

@ -10,13 +10,15 @@ from github import Github
def main():
bucket_name = os.environ['BUCKET_NAME']
upload_prefix = os.environ['UPLOAD_PREFIX']
release_number = os.environ['RELEASE_NUMBER']
full_prefix = upload_prefix + '/' + release_number[0:-2] + '/' + release_number + '/'
S3 = boto3.client('s3')
path = os.path.join(os.getcwd(), os.environ['ARTIFACT_PATTERN'])
files = glob.glob(path, recursive=False)
for archiveFile in files:
filePath, fileName = os.path.split(archiveFile)
S3.upload_file(os.path.join(filePath, fileName), bucket_name, upload_prefix + '/' + fileName)
print("Uploaded Artifact to S3: https://{}.s3-us-west-2.amazonaws.com/{}/{}".format(bucket_name, upload_prefix, fileName))
S3.upload_file(os.path.join(filePath, fileName), bucket_name, full_prefix + '/' + fileName)
print("Uploaded Artifact to S3: https://{}.s3-us-west-2.amazonaws.com/{}/{}".format(bucket_name, full_prefix, fileName))
print("Finished")
main()