Skip to content

Commit

Permalink
Use Sonatype token username and token password (#102)
Browse files Browse the repository at this point in the history
* use sonatype tokens instead of username/pass

* update prompts
  • Loading branch information
KevinGe00 authored Nov 6, 2024
1 parent 1c8cf43 commit 32493f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
14 changes: 7 additions & 7 deletions .lipublish/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
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'
4 changes: 2 additions & 2 deletions .lipublish/publishSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ limitations under the License.
<servers>
<server>
<id>ossrh</id>
<username>${env.MVN_DEPLOY_SONATYPE_USER}</username>
<password>${env.MVN_DEPLOY_SONATYPE_PASSWORD}</password>
<username>${env.MVN_DEPLOY_SONATYPE_TOKEN_USERNAME}</username>
<password>${env.MVN_DEPLOY_SONATYPE_TOKEN_PASSWORD}</password>
</server>
</servers>
<profiles>
Expand Down

0 comments on commit 32493f8

Please sign in to comment.