diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7004d67..e246feb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,11 @@ jobs: with: fetch-depth: 0 + - name: Configure Git user + run: | + git config user.email "actions@github.com" + git config user.name "GitHub Actions" + - name: Setup Java uses: actions/setup-java@v3 with: @@ -29,20 +34,29 @@ jobs: distribution: 'temurin' cache: maven - - name: Configure Git user - run: | - git config user.email "actions@github.com" - git config user.name "GitHub Actions" - - name: Set Release Version id: vars shell: bash run: | echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT - mvn -ntp -B versions:set -DnewVersion=${{ github.event.inputs.version }}-SNAPSHOT + mvn -ntp --batch-mode versions:set -DnewVersion=${{ github.event.inputs.version }} git diff-index --quiet HEAD || git commit -m "Releasing version ${{ github.event.inputs.version }}" pom.xml - name: Publish to GitHub Packages - run: mvn -ntp -B release:prepare release:perform + run: mvn -ntp --batch-mode clean deploy -Prelease env: GITHUB_TOKEN: ${{ github.token }} + + - name: Set up Java for publishing to Maven Central + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + - name: Publish to the Maven Central + run: mvn --batch-mode deploy -Prelease,mavencentral-release + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} diff --git a/pom.xml b/pom.xml index 8605d4c..2ba7651 100644 --- a/pom.xml +++ b/pom.xml @@ -213,4 +213,90 @@ https://maven.pkg.github.com/wiremock/wiremock-testcontainers-java + + + + release + + 3.0.0-M7 + 3.0.1 + + + + + + maven-release-plugin + ${version.maven-release-plugin} + + @{project.version} + + + + + maven-gpg-plugin + ${version.maven-gpg-plugin} + + + sign-artifacts + verify + + sign + + + + + + --pinentry-mode + loopback + + + + + + + + + + maven-gpg-plugin + + + + + + mavencentral-release + + 1.6.13 + + + + ossrh + Central Repository OSSRH + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + ${version.nexus-staging-maven-plugin} + true + + ossrh + https://s01.oss.sonatype.org + true + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + + + + +