xref: /aosp_15_r20/external/aws-sdk-java-v2/buildspecs/release-to-maven.yml (revision 8a52c7834d808308836a99fc2a6e0ed8db339086)
1*8a52c783SCole Faustversion: 0.2
2*8a52c783SCole Faust
3*8a52c783SCole Faustphases:
4*8a52c783SCole Faust  install:
5*8a52c783SCole Faust    commands:
6*8a52c783SCole Faust      - pip install awscli --upgrade --user
7*8a52c783SCole Faust
8*8a52c783SCole Faust  pre_build:
9*8a52c783SCole Faust    commands:
10*8a52c783SCole Faust      - ROOT=`pwd`
11*8a52c783SCole Faust      - SETTINGS_XML_TEMPLATE=buildspecs/resources/release-settings.xml
12*8a52c783SCole Faust      - SETTINGS_XML=release-settings-final.xml
13*8a52c783SCole Faust      - SDK_SIGNING_GPG_SECRING=secring.gpg
14*8a52c783SCole Faust      - SDK_SIGNING_GPG_SECRING_ARN="arn:aws:secretsmanager:us-east-1:103431983078:secret:sdk-signing-gpg-secret-ring-9d0YXc"
15*8a52c783SCole Faust      - SDK_SIGNING_GPG_KEYNAME_ARN="arn:aws:secretsmanager:us-east-1:103431983078:secret:sdk-signing-gpg-keyname-wFsOOg"
16*8a52c783SCole Faust      - SDK_SIGNING_GPG_PASSPHRASE_ARN="arn:aws:secretsmanager:us-east-1:103431983078:secret:sdk-signing-gpg-passphrase-A0H1Kq"
17*8a52c783SCole Faust      - SONATYPE_PASSWORD_ARN="arn:aws:secretsmanager:us-east-1:103431983078:secret:sonatype-password-I2V6Y0"
18*8a52c783SCole Faust
19*8a52c783SCole Faust  build:
20*8a52c783SCole Faust    commands:
21*8a52c783SCole Faust      - RELEASE_VERSION=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
22*8a52c783SCole Faust      - SONATYPE_URL="https://aws.oss.sonatype.org/service/local/repositories/releases/content/software/amazon/awssdk/aws-sdk-java/$RELEASE_VERSION/"
23*8a52c783SCole Faust      - |
24*8a52c783SCole Faust        if ! curl -f --head $SONATYPE_URL; then
25*8a52c783SCole Faust          SONATYPE_PASSWORD=`aws secretsmanager get-secret-value --secret-id $SONATYPE_PASSWORD_ARN --query SecretString --output text`
26*8a52c783SCole Faust          SDK_SIGNING_GPG_KEYNAME=`aws secretsmanager get-secret-value --secret-id $SDK_SIGNING_GPG_KEYNAME_ARN --query SecretString --output text`
27*8a52c783SCole Faust          SDK_SIGNING_GPG_PASSPHRASE=`aws secretsmanager get-secret-value --secret-id $SDK_SIGNING_GPG_PASSPHRASE_ARN --query SecretString --output text`
28*8a52c783SCole Faust          aws secretsmanager get-secret-value --secret-id  $SDK_SIGNING_GPG_SECRING_ARN --query SecretBinary --output text | base64 -d > $SDK_SIGNING_GPG_SECRING
29*8a52c783SCole Faust          gpg --passphrase $SDK_SIGNING_GPG_PASSPHRASE --batch --import $SDK_SIGNING_GPG_SECRING
30*8a52c783SCole Faust
31*8a52c783SCole Faust          cat $SETTINGS_XML_TEMPLATE | \
32*8a52c783SCole Faust            awk 'BEGIN { var=ENVIRON["SONATYPE_PASSWORD"] } { gsub("\\$SONATYPE_PASSWORD", var, $0); print }' | \
33*8a52c783SCole Faust            awk 'BEGIN { var=ENVIRON["SDK_SIGNING_GPG_PASSPHRASE"] } { gsub("\\$SDK_SIGNING_GPG_PASSPHRASE", var, $0); print }' | \
34*8a52c783SCole Faust            awk 'BEGIN { var=ENVIRON["SDK_SIGNING_GPG_KEYNAME"] } { gsub("\\$SDK_SIGNING_GPG_KEYNAME", var, $0); print }' > \
35*8a52c783SCole Faust            $SETTINGS_XML
36*8a52c783SCole Faust
37*8a52c783SCole Faust          mvn clean deploy -B -s $SETTINGS_XML -Ppublishing -DperformRelease -Dspotbugs.skip -DskipTests -Dcheckstyle.skip -Djapicmp.skip -Ddoclint=none -pl !:protocol-tests,!:protocol-tests-core,!:codegen-generated-classes-test,!:sdk-benchmarks,!:module-path-tests,!:tests-coverage-reporting,!:stability-tests,!:sdk-native-image-test,!:auth-tests,!:s3-benchmarks,!:region-testing,!:old-client-version-compatibility-test -DautoReleaseAfterClose=true -DstagingProgressTimeoutMinutes=30 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true
38*8a52c783SCole Faust        else
39*8a52c783SCole Faust          echo "This version was already released."
40*8a52c783SCole Faust        fi
41