Skip to content

Commit

Permalink
add release maven result to s3, sdk zip file to latest folder of s3
Browse files Browse the repository at this point in the history
  • Loading branch information
sunchunqiang committed Jan 10, 2019
1 parent 7085d88 commit bcdcbb4
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,17 @@ jobs:
echo "$ANDROID_HOME"
echo "$M2_HOME"
bash CircleciScripts/maven-release.sh
- run:
name: install aws cli
command: |
sudo pip install awscli
aws configure --profile android_stage set region us-east-1
echo -e "[android_stage]\naws_access_key_id=${AWS_ACCESS_KEY_ID_ANDROID}\naws_secret_access_key=${AWS_SECRET_ACCESS_KEY_ANDROID}\n" >> ~/.aws/credentials
- run:
name: upload to maven
command: |
version=$(echo "${CIRCLE_TAG}" | sed 's|.*v\([0-9\.]*\).*|\1|')
python3 CircleciScripts/s3_maven.py "$(pwd)" %version android_stage "aws-android-sdk-stage-csun/com/amazonaws"
release_s3:
docker:
Expand Down Expand Up @@ -267,7 +278,9 @@ jobs:
command: |
aws configure --profile android_stage set region us-east-1
echo -e "[android_stage]\naws_access_key_id=${AWS_ACCESS_KEY_ID_ANDROID}\naws_secret_access_key=${AWS_SECRET_ACCESS_KEY_ANDROID}\n" >> ~/.aws/credentials
aws s3 cp "$sdkversion.zip" "s3://mylistname/test/$sdkversion.zip" --profile android_stage
aws s3 cp "$sdkversion.zip" "s3://aws-android-sdk-stage-csun/$sdkversion.zip" --profile android_stage
aws s3 cp "$sdkversion.zip" "s3://aws-android-sdk-stage-csun/latest/aws-android-sdk.zip" --profile android_stage
workflows:
version: 2
build_test:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ fastlane/readme.md

# maven file
target/

#python comile
__pycache__/
Binary file removed CircleciScripts/__pycache__/functions.cpython-37.pyc
Binary file not shown.
24 changes: 24 additions & 0 deletions CircleciScripts/s3_maven.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os
import sys
from functions import getmodules
from functions import runcommand
from shutil import copyfile
from pathlib import Path
root = sys.argv[1]
version = sys.argv[2]
s3profile = sys.argv[3]
s3prefix=sys.argv[4]
#"aws-android-sdk-stage-csun/com/amazonaws"

modules = getmodules(root)
for module in modules:
target = os.path.join(root, module, "target")
s3maven = os.path.join(target, "s3maven")
runcommand("mkdir -p '{0}'".format(s3maven))
for file in os.listdir(target):
sourcefile = os.path.join(target, file)
if os.path.isfile(sourcefile) and (version in file):
targetfile = os.path.join(s3maven, file)
copyfile(sourcefile, targetfile)
print("upload module {0} ...".format(module))
runcommand('aws s3 sync "{0}" s3://{1}/{2}/{3} --profile {4}'.format(s3maven, s3prefix, module,version,s3profile))

0 comments on commit bcdcbb4

Please sign in to comment.