Skip to content

Commit

Permalink
update sonatype to use token (#563)
Browse files Browse the repository at this point in the history
* update sonatype to use token
  • Loading branch information
sbSteveK authored Apr 11, 2024
1 parent c7107b9 commit 829ab89
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'docs'

env:
BUILDER_VERSION: v0.9.53
BUILDER_VERSION: v0.9.58
BUILDER_SOURCE: releases
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-iot-device-sdk-java-v2
Expand Down
2 changes: 1 addition & 1 deletion codebuild/cd/deploy-snapshot-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ cd ./android
GPG_KEY=$(cat /tmp/aws-sdk-common-runtime.key.asc)

# Publish to nexus
./gradlew -PnewVersion=$PKG_VERSION -PsigningKey=$"$GPG_KEY" -PsigningPassword=$GPG_PASSPHRASE -PsonatypeUsername='aws-sdk-common-runtime' -PsonatypePassword=$ST_PASSWORD publishToAwsNexus closeAwsNexusStagingRepository | tee /tmp/android_deploy.log
./gradlew -PnewVersion=$PKG_VERSION -PsigningKey=$"$GPG_KEY" -PsigningPassword=$GPG_PASSPHRASE -PsonatypeUsername=$ST_USERNAME -PsonatypePassword=$ST_PASSWORD publishToAwsNexus closeAwsNexusStagingRepository | tee /tmp/android_deploy.log
# Get the staging repository id and save it
cat /tmp/android_deploy.log | grep "Created staging repository" | cut -d\' -f2 | tee /tmp/android_repositoryId.txt
10 changes: 6 additions & 4 deletions codebuild/cd/deploy-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ phases:

# install settings.xml to ~/.m2/settings.xml
- mkdir -p $HOME/.m2
- export CD_SETTINGS=$(aws secretsmanager get-secret-value --secret-id cd/aws-crt-java-settings --query "SecretString" | cut -f2 -d\")
- export CD_SETTINGS=$(aws secretsmanager get-secret-value --secret-id cd/aws-crt-java-settings/token --query "SecretString" | cut -f2 -d\")
- echo $CD_SETTINGS > $HOME/.m2/settings.xml

- export ST_PASSWORD=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id cd/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
# Use the password and username from secret manager to update the settings
- export ST_USERNAME=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/token | cut -f2 -d":" | cut -f1 -d"," | sed -e 's/[\\\"\}]//g')
- export ST_PASSWORD=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/token | cut -f3 -d":" | sed -e 's/[\\\"\}]//g')
- sed -i 's|token-username|'"$ST_USERNAME"'|g' $HOME/.m2/settings.xml
- sed -i 's|token-password|'"$ST_PASSWORD"'|g' $HOME/.m2/settings.xml

# import gpg key
- export CD_KEY=$(aws secretsmanager get-secret-value --secret-id cd/aws-crt-java-key --query "SecretString" | cut -f2 -d\")
Expand Down
10 changes: 6 additions & 4 deletions codebuild/cd/promote-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ phases:

# install settings.xml to ~/.m2/settings.xml
- mkdir -p $HOME/.m2
- export CD_SETTINGS=$(aws secretsmanager get-secret-value --secret-id cd/aws-crt-java-settings --query "SecretString" | cut -f2 -d\")
- export CD_SETTINGS=$(aws secretsmanager get-secret-value --secret-id cd/aws-crt-java-settings/token --query "SecretString" | cut -f2 -d\")
- echo $CD_SETTINGS > $HOME/.m2/settings.xml

- export ST_PASSWORD=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id cd/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
# Use the password and username from secret manager to update the settings
- export ST_USERNAME=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/token | cut -f2 -d":" | cut -f1 -d"," | sed -e 's/[\\\"\}]//g')
- export ST_PASSWORD=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/token | cut -f3 -d":" | sed -e 's/[\\\"\}]//g')
- sed -i 's|token-username|'"$ST_USERNAME"'|g' $HOME/.m2/settings.xml
- sed -i 's|token-password|'"$ST_PASSWORD"'|g' $HOME/.m2/settings.xml

# import gpg key
- export CD_KEY=$(aws secretsmanager get-secret-value --secret-id cd/aws-crt-java-key --query "SecretString" | cut -f2 -d\")
Expand Down

0 comments on commit 829ab89

Please sign in to comment.