From 32493f860b1f60173bd76703db2471685309a264 Mon Sep 17 00:00:00 2001 From: Kevin Ge Date: Wed, 6 Nov 2024 14:36:14 -0500 Subject: [PATCH] Use Sonatype token username and token password (#102) * use sonatype tokens instead of username/pass * update prompts --- .github/workflows/maven-publish.yml | 8 ++++---- .lipublish/publish.sh | 14 +++++++------- .lipublish/publishSettings.xml | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index c3eafa92a..0eb56ca4a 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -22,14 +22,14 @@ jobs: with: ref: 'li-1.21.0' fetch-depth: 0 - + - name: Set up JDK 8 uses: actions/setup-java@v3 with: java-version: '8' distribution: 'temurin' server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - + - name: Import GPG key id: import_gpg uses: crazy-max/ghaction-import-gpg@v5 @@ -42,6 +42,6 @@ jobs: chmod +x .lipublish/publish.sh .lipublish/publish.sh env: - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_TOKEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_USERNAME }} + SONATYPE_TOKEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }} GPG_PASSWD: ${{ secrets.GPG_PASSWD }} diff --git a/.lipublish/publish.sh b/.lipublish/publish.sh index 49e52f9c0..ef9666282 100644 --- a/.lipublish/publish.sh +++ b/.lipublish/publish.sh @@ -17,13 +17,13 @@ echo "!!This will change the pom.xml files and you will need to revert them. If you have local changes, exit now and stash them!!" -while [ -z "$SONATYPE_USERNAME" ]; do - echo "Please provide your sonatype username" - read SONATYPE_USERNAME +while [ -z "$SONATYPE_TOKEN_USERNAME" ]; do + echo "Please provide your sonatype token username" + read SONATYPE_TOKEN_USERNAME done -while [ -z "$SONATYPE_PASSWORD" ]; do - echo "Please provide your sonatype password" - read SONATYPE_PASSWORD +while [ -z "$SONATYPE_TOKEN_PASSWORD" ]; do + echo "Please provide your sonatype token password" + read SONATYPE_TOKEN_PASSWORD echo done while [ -z "$GPG_PASSWD" ]; do @@ -52,4 +52,4 @@ mvn versions:set -DnewVersion="$BUILD_VERSION" -q -B mvn versions:commit -q -B echo "Publishing to maven central" -MVN_DEPLOY_SONATYPE_USER=$SONATYPE_USERNAME MVN_DEPLOY_SONATYPE_PASSWORD=$SONATYPE_PASSWORD MVN_DEPLOY_GPG_PASSWD=$GPG_PASSWD eval 'mvn clean deploy -s .lipublish/publishSettings.xml -DskipTests -q -DretryFailedDeploymentCount=5' \ No newline at end of file +MVN_DEPLOY_SONATYPE_TOKEN_USERNAME=$SONATYPE_TOKEN_USERNAME MVN_DEPLOY_SONATYPE_TOKEN_PASSWORD=$SONATYPE_TOKEN_PASSWORD MVN_DEPLOY_GPG_PASSWD=$GPG_PASSWD eval 'mvn clean deploy -s .lipublish/publishSettings.xml -DskipTests -q -DretryFailedDeploymentCount=5' \ No newline at end of file diff --git a/.lipublish/publishSettings.xml b/.lipublish/publishSettings.xml index bec32468a..143250ed7 100644 --- a/.lipublish/publishSettings.xml +++ b/.lipublish/publishSettings.xml @@ -19,8 +19,8 @@ limitations under the License. ossrh - ${env.MVN_DEPLOY_SONATYPE_USER} - ${env.MVN_DEPLOY_SONATYPE_PASSWORD} + ${env.MVN_DEPLOY_SONATYPE_TOKEN_USERNAME} + ${env.MVN_DEPLOY_SONATYPE_TOKEN_PASSWORD}