Skip to content
Prev Previous commit
Next Next commit
fix shell script
  • Loading branch information
TingDaoK committed May 30, 2025
commit 87d4ca56681f32252667a03a26d02882b6d3d97c
2 changes: 1 addition & 1 deletion codebuild/cd/publish-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GPG_KEY=$(cat /tmp/aws-sdk-common-runtime.key.asc)
# the release will need to be invoked within the same call.
# https://github.com/gradle-nexus/publish-plugin/issues/379

if [ "$PROMOTE_RELEASE" == "true" ]; then
if [ "$PROMOTE_RELEASE" = "true" ]; then
# close and release the staging repository to promote release
../gradlew -PsigningKey=$"$GPG_KEY" -PsigningPassword=$MAVEN_GPG_PASSPHRASE -PsonatypeUsername=$ST_USERNAME -PsonatypePassword=$ST_PASSWORD publishToSonatype closeAndReleaseSonatypeStagingRepository
else
Expand Down
9 changes: 4 additions & 5 deletions codebuild/cd/publish-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,22 @@ fi

echo "Uploading bundle to Sonatype Central..."

# # Upload bundle
# Upload bundle
DEPLOY_ID=$(curl \
--fail \
--verbose \
--show-error \
--request POST \
--header "Authorization: Bearer ${AUTH_HEADER_VAL}" \
--form "bundle=@${BUNDLE_FILE}" \
"${SONATYPE_API_UPLOAD_URL}" 2>&1) || {
"${SONATYPE_API_UPLOAD_URL}") || {
echo "Error: Failed to upload bundle to Sonatype Central"
exit 1
}

echo "Successfully uploaded. Deployment ID: ${DEPLOY_ID}"


if [ "$PROMOTE_RELEASE" == "true" ]; then
if [ "$PROMOTE_RELEASE" = "true" ]; then
SONATYPE_API_PUBLISH_URL="https://central.sonatype.com/api/v1/publisher/deployment/${DEPLOY_ID}"

echo "Publishing deployment ${DEPLOY_ID}..."
Expand All @@ -58,4 +57,4 @@ if [ "$PROMOTE_RELEASE" == "true" ]; then
echo "Successfully published deployment"
else
echo "Skipping publish step (testing mode). You need to manually drop/publish the deployment in Maven Central."
fi
fi
6 changes: 4 additions & 2 deletions codebuild/cd/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@ phases:
- export BUNDLE_DIR=$CODEBUILD_SRC_DIR/aws-crt-java/bundle/
- mkdir -p $BUNDLE_DIR
- mvn -B versions:set -DnewVersion=${DEPLOY_VERSION}
# bundle the JAR to the local bundle directory
- mvn -B deploy -Prelease -Dshared-lib.skip=true -Dmaven.test.skip=true -DstagingDirectory=${BUNDLE_DIR} -DskipPublishing=true
- bash ./codebuild/cd/deploy-platform-specific-jars.sh
- bash ./codebuild/cd/bundle-platform-specific-jars.sh
- cd ${BUNDLE_DIR}
# create a zip file of the bundle
- zip -r $CODEBUILD_SRC_DIR/aws-crt-java/bundle.zip .

post_build:
commands:
- cd $CODEBUILD_SRC_DIR/aws-crt-java
# Test the publish without promoting the release. You need to manually drop the release.
# Publish and promote the release.
- export PROMOTE_RELEASE=true
- ./codebuild/cd/publish-bundle.sh
# deploy android
Expand Down
Loading