diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c28f949..210ef8c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,15 +61,7 @@ jobs: git config --global user.name "GitHub Actions" - name: Un-SNAP - run: | - mvnwPath=$(readlink -f ./mvnw) - modules=("") # root - modules+=($(grep -oP '(?<=)[^<]+' 'pom.xml')) - for i in "${modules[@]}" - do - echo "Processing $i/pom.xml" - (cd "$i" && $mvnwPath -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false) - done + run: ./mvnw -B versions:set -DremoveSnapshot -DprocessAllModules -DgenerateBackupPoms=false - name: Get version id: version @@ -112,6 +104,9 @@ jobs: runs-on: ubuntu-latest needs: [prepare-release] timeout-minutes: 60 + permissions: + contents: read + packages: write steps: - uses: actions/checkout@v4 @@ -120,20 +115,34 @@ jobs: git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" git pull + + - name: Set up JDK + uses: actions/setup-java@v4 + with: # running setup-java overwrites the settings.xml + distribution: 'temurin' + java-version: '17' + gpg-passphrase: MAVEN_GPG_PASSPHRASE + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once + - name: Publish to Central Portal + run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github::https://maven.pkg.github.com/${{ github.repository }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} + - name: Set up JDK uses: actions/setup-java@v4 with: # running setup-java again overwrites the settings.xml - java-version: '17' distribution: 'temurin' + java-version: '17' server-id: sonatype-central-portal server-username: MAVEN_CENTRAL_USERNAME server-password: MAVEN_CENTRAL_TOKEN gpg-passphrase: MAVEN_GPG_PASSPHRASE - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - name: Publish to Central Portal - run: ../mvnw -B deploy -P publish-sonatype-central-portal -DskipTests + run: ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests env: MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }} MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }} @@ -185,15 +194,7 @@ jobs: git pull - name: Inc Version and SNAP - run: | - mvnwPath=$(readlink -f ./mvnw) - modules=("") # root - modules+=($(grep -oP '(?<=)[^<]+' 'pom.xml')) - for i in "${modules[@]}" - do - echo "Processing $i/pom.xml" - (cd "$i" && $mvnwPath -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true -DupdateMatchingVersions=false) - done + run: ./mvnw -B versions:set -DnextSnapshot -DprocessAllModules -DgenerateBackupPoms=false - name: Git Commit and Push run: | diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 8a85891..922eda0 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -10,8 +10,26 @@ jobs: publish-maven: runs-on: ubuntu-latest timeout-minutes: 60 + permissions: + contents: read + packages: write steps: - uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: # running setup-java overwrites the settings.xml + distribution: 'temurin' + java-version: '17' + gpg-passphrase: MAVEN_GPG_PASSPHRASE + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once + + - name: Publish to GitHub Packages + run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github::https://maven.pkg.github.com/${{ github.repository }} + working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - name: Set up JDK uses: actions/setup-java@v4 @@ -22,10 +40,9 @@ jobs: server-username: MAVEN_CENTRAL_USERNAME server-password: MAVEN_CENTRAL_TOKEN gpg-passphrase: MAVEN_GPG_PASSPHRASE - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - name: Publish to Central Portal - run: ../mvnw -B deploy -P publish-sonatype-central-portal -DskipTests + run: ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} env: MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }} diff --git a/pom.xml b/pom.xml index 567130e..d0de938 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ com.puppycrawl.tools checkstyle - 10.26.0 + 10.26.1 @@ -82,12 +82,12 @@ net.sourceforge.pmd pmd-core - 7.14.0 + 7.15.0 net.sourceforge.pmd pmd-java - 7.14.0 + 7.15.0 diff --git a/sessionize-java-client/pom.xml b/sessionize-java-client/pom.xml index 663f9cf..7bbe439 100644 --- a/sessionize-java-client/pom.xml +++ b/sessionize-java-client/pom.xml @@ -217,7 +217,7 @@ - publish-sonatype-central-portal + publish @@ -240,7 +240,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.2.7 + 3.2.8 sign-artifacts @@ -259,7 +259,13 @@ - + + + + + publish-sonatype-central-portal + + org.sonatype.central central-publishing-maven-plugin @@ -443,7 +449,7 @@ com.puppycrawl.tools checkstyle - 10.26.0 + 10.26.1 @@ -484,12 +490,12 @@ net.sourceforge.pmd pmd-core - 7.14.0 + 7.15.0 net.sourceforge.pmd pmd-java - 7.14.0 + 7.15.0