@@ -104,6 +104,9 @@ jobs:
104104 runs-on : ubuntu-latest
105105 needs : [prepare-release]
106106 timeout-minutes : 60
107+ permissions :
108+ contents : read
109+ packages : write
107110 steps :
108111 - uses : actions/checkout@v4
109112
@@ -112,20 +115,34 @@ jobs:
112115 git config --global user.email "actions@github.com"
113116 git config --global user.name "GitHub Actions"
114117 git pull
118+
119+ - name : Set up JDK
120+ uses : actions/setup-java@v4
121+ with : # running setup-java overwrites the settings.xml
122+ distribution : ' temurin'
123+ java-version : ' 17'
124+ gpg-passphrase : MAVEN_GPG_PASSPHRASE
125+ gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once
115126
127+ - name : Publish to Central Portal
128+ run : ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github::https://maven.pkg.github.com/${{ github.repository }}
129+ env :
130+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
131+ MAVEN_GPG_PASSPHRASE : ${{ secrets.MAVEN_GPG_PASSPHRASE }}
132+ working-directory : ${{ env.PRIMARY_MAVEN_MODULE }}
133+
116134 - name : Set up JDK
117135 uses : actions/setup-java@v4
118136 with : # running setup-java again overwrites the settings.xml
119- java-version : ' 17'
120137 distribution : ' temurin'
138+ java-version : ' 17'
121139 server-id : sonatype-central-portal
122140 server-username : MAVEN_CENTRAL_USERNAME
123141 server-password : MAVEN_CENTRAL_TOKEN
124142 gpg-passphrase : MAVEN_GPG_PASSPHRASE
125- gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
126143
127144 - name : Publish to Central Portal
128- run : ../mvnw -B deploy -P publish-sonatype-central-portal -DskipTests
145+ run : ../mvnw -B deploy -P publish,publish -sonatype-central-portal -DskipTests
129146 env :
130147 MAVEN_CENTRAL_USERNAME : ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }}
131148 MAVEN_CENTRAL_TOKEN : ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }}
0 commit comments