version: 0.2 #this buildspec assumes the aws-common-runtime/ubuntu-16.04 image # This job is responsible for artifacting the JAR which will have all of the other shared libs stuffed # into it once all platforms are built and artifacted phases: install: commands: - sudo add-apt-repository ppa:openjdk-r/ppa - sudo apt-get update -y - sudo apt-get install openjdk-8-jdk-headless maven -y -f pre_build: commands: - cd $CODEBUILD_SRC_DIR/aws-crt-java - export PKG_VERSION=$(git describe --tags | cut -f2 -dv) - echo PKG_VERSION=$PKG_VERSION # install settings.xml to ~/.m2/settings.xml - mkdir -p $HOME/.m2 - aws s3 cp s3://code-sharing-aws-crt/aws-crt-java.settings.xml $HOME/.m2/settings.xml # import gpg key - aws s3 cp s3://code-sharing-aws-crt/aws-sdk-common-runtime.key.asc /tmp/aws-sdk-common-runtime.key.asc - gpg --import /tmp/aws-sdk-common-runtime.key.asc - export GPG_PASSPHRASE=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id aws-sdk-common-runtime.key.asc/password | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') - export REPOSITORY_ID=$(cat $CODEBUILD_SRC_DIR_aws_crt/repositoryId.txt) - export ANDROID_REPOSITORY_ID=$(cat $CODEBUILD_SRC_DIR_aws_crt/android_repositoryId.txt) - export ST_PASSWORD=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/Password | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') # Use the password from secret manager to update the settings - sed -i 's/password-to-replace/'"$ST_PASSWORD"'/g' $HOME/.m2/settings.xml build: commands: - cd $CODEBUILD_SRC_DIR/aws-crt-java # Trigger the release of the last staged package in the staging repository - mvn -B nexus-staging:release -Prelease -DstagingRepositoryId=$REPOSITORY_ID - mvn -B nexus-staging:release -Prelease -DstagingRepositoryId=$ANDROID_REPOSITORY_ID post_build: commands: cache: paths: - "/root/.m2/**/*"