@@ -16,24 +16,60 @@ jobs:
1616 run : |
1717 echo "${{ secrets.MAVEN_GPG_PRIVATE_KEY }}" | gpg --batch --import
1818 echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf
19-
20- - name : Set up JDK
19+
20+ - name : Extract version from pom.xml
21+ id : get_version
22+ run : |
23+ version=$(xmllint --xpath "/*[local-name()='project']/*[local-name()='version']/text()" auto-generated-sdk/pom.xml)
24+ echo "version=$version" >> $GITHUB_OUTPUT
25+ if [[ "$version" == *SNAPSHOT* ]]; then
26+ echo "is_snapshot=true" >> $GITHUB_OUTPUT
27+ else
28+ echo "is_snapshot=false" >> $GITHUB_OUTPUT
29+ fi
30+
31+ - name : Set up JDK for snapshot repository
32+ if : steps.get_version.outputs.is_snapshot == 'true'
33+ uses : actions/setup-java@v4
34+ with :
35+ java-version : ' 8'
36+ distribution : ' temurin'
37+ server-id : central-portal-snapshots
38+ server-username : MAVEN_PORTAL_USERNAME
39+ server-password : MAVEN_CENTRAL_TOKEN
40+ gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
41+ gpg-passphrase : MAVEN_GPG_PASSPHRASE
42+
43+ - name : Set up JDK for release repository
44+ if : steps.get_version.outputs.is_snapshot == 'false'
2145 uses : actions/setup-java@v4
2246 with :
2347 java-version : ' 8'
2448 distribution : ' temurin'
25- server-id : central # Value of the distributionManagement/repository/id field of the pom.xml
26- server-username : MAVEN_PORTAL_USERNAME # env variable for username in deploy
27- server-password : MAVEN_CENTRAL_TOKEN # env variable for token in deploy
28- gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
49+ server-id : central
50+ server-username : MAVEN_PORTAL_USERNAME
51+ server-password : MAVEN_CENTRAL_TOKEN
52+ gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
2953 gpg-passphrase : MAVEN_GPG_PASSPHRASE
54+
55+ # - name: Set up JDK
56+ # if: steps.get_version.outputs.is_snapshot == 'true'
57+ # uses: actions/setup-java@v4
58+ # with:
59+ # java-version: '8'
60+ # distribution: 'temurin'
61+ # server-id: central # Value of the distributionManagement/repository/id field of the pom.xml
62+ # server-username: MAVEN_PORTAL_USERNAME # env variable for username in deploy
63+ # server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
64+ # gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
65+ # gpg-passphrase: MAVEN_GPG_PASSPHRASE
3066
3167 - name : Build with Maven
3268 run : mvn -B package --file auto-generated-sdk/pom.xml
3369
3470 - name : Publish to Apache Maven Central
35- run : cd auto-generated-sdk && mvn verify deploy
71+ run : cd auto-generated-sdk && mvn -Psign-artifacts verify deploy
3672 env :
37- MAVEN__PORTAL_USERNAME : ${{ secrets.MAVEN_CENTRAL_USERNAME }}
73+ MAVEN_PORTAL_USERNAME : ${{ secrets.MAVEN_CENTRAL_USERNAME }}
3874 MAVEN_CENTRAL_TOKEN : ${{ secrets.MAVEN_CENTRAL_TOKEN }}
3975 MAVEN_GPG_PASSPHRASE : ${{ secrets.MAVEN_GPG_PASSPHRASE }}
0 commit comments