diff --git a/.github/workflows/publish-and-deploy-to-maven-central.yml b/.github/workflows/publish-and-deploy-to-maven-central.yml new file mode 100644 index 0000000..d978da5 --- /dev/null +++ b/.github/workflows/publish-and-deploy-to-maven-central.yml @@ -0,0 +1,91 @@ +--- + name: Publish and deploy package to maven central + + on: + push: + branches: + - main + - beta + - alpha + - dev + + jobs: + publish-new-version: + name: Publish new version + runs-on: ubuntu-latest + environment: publisher + outputs: + new_release_published: ${{ steps.semantic-release.outputs.new_release_published }} + steps: + - name: Create GitHub app token + uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.GH_APP_ID }} + private-key: ${{ secrets.GH_PRIVATE_KEY }} + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ steps.app-token.outputs.token }} + persist-credentials: false + - name: Import GPG key + id: import-gpg + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + git_user_signingkey: true + git_commit_gpgsign: true + - name: Setup JDK 21 + uses: actions/setup-java@v4 + with: + java-version: "21" + distribution: temurin + cache: maven + - name: Publish version + uses: cycjimmy/semantic-release-action@v4 + id: semantic-release + with: + extra_plugins: | + @semantic-release/exec + semantic-release-gitmoji + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} + GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }} + GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }} + GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }} + GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }} + + deploy-package-to-maven-central: + name: Deploy package to Maven Central + needs: publish-new-version + runs-on: ubuntu-latest + environment: deployment + if: needs.publish-new-version.outputs.new_release_published == 'true' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + ref: ${{ github.ref }} + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + - name: Setup JDK 21 + uses: actions/setup-java@v4 + with: + java-version: "21" + distribution: temurin + cache: maven + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} + - name: Deploy package + run: ./mvnw deploy -s ./settings.xml + env: + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} diff --git a/.github/workflows/publish-to-maven-central.yml b/.github/workflows/publish-to-maven-central.yml deleted file mode 100644 index 7c512a0..0000000 --- a/.github/workflows/publish-to-maven-central.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -name: Publish package to maven central - -on: - push: - branches: - - main - - beta - - alpha - - dev - -jobs: - deploy-and-publish: - name: Deploy and publish package - runs-on: ubuntu-latest - environment: deployment - steps: - - name: Create GitHub app token - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ secrets.GH_APP_ID }} - private-key: ${{ secrets.GH_PRIVATE_KEY }} - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ steps.app-token.outputs.token }} - persist-credentials: false - - name: Import GPG key - id: import-gpg - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.GPG_PASSPHRASE }} - git_user_signingkey: true - git_commit_gpgsign: true - - name: Setup JDK 21 - uses: actions/setup-java@v4 - with: - java-version: "21" - distribution: temurin - cache: maven - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} - - name: Publish package - id: semantic - uses: cycjimmy/semantic-release-action@v4 - with: - extra_plugins: | - @semantic-release/exec - semantic-release-gitmoji - env: - GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} - GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }} - GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }} - GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }} - GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} - MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} diff --git a/.releaserc.yml b/.releaserc.yml index 23d6418..d01e172 100644 --- a/.releaserc.yml +++ b/.releaserc.yml @@ -13,10 +13,9 @@ plugins: - changelogFile: CHANGELOG.md - - "@semantic-release/exec" - prepareCmd: "./mvnw versions:set -DnewVersion=${nextRelease.version}" - publishCmd: "./mvnw deploy -s ./settings.xml" - "@semantic-release/github" - - "@semantic-release/git" - assets: - CHANGELOG.md - pom.xml - message: "🔖 Update `package.json` to `${nextRelease.version}` [skip release]\n\n${nextRelease.notes}" \ No newline at end of file + message: "🔖 Update `package.json` to `${nextRelease.version}` [skip release]\n\n${nextRelease.notes}" diff --git a/README.md b/README.md index 2bb62bc..3fc2ef7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Welcome to **maven-java-template**, a flexible starting point for creating Maven ## Features -- **Dependencies**: Preconfigured with Lombok, Checker Framework, Mockito, and JUnit. +- **Dependencies**: Preconfigured with Checker Framework, Mockito, and JUnit. - **Plugins**: Includes Checkstyle, Source, Javadoc, GPG, Central Publishing, JaCoCo, Checker Framework, Jar, and Assembly. - **Branching Strategy**: Four branches (`main`, `beta`, `alpha`, and `dev`) to manage different stages of development and release. - **CI/CD Pipelines**: Automated checks for code style, build, testing, static code analysis, and publishing to Maven Central. diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000..0cd4424 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index c75d594..6f18c0b 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,6 @@ 3.7.1 5.12.0 3.8.0 - 1.18.34 0.8.12 3.3.1 5.10.3 @@ -79,13 +78,6 @@ ${maven.checkerframework.version} - - org.projectlombok - lombok - ${maven.lombok.version} - provided - - org.junit.jupiter junit-jupiter @@ -115,6 +107,7 @@ ${maven.checkstyle.version} true + checkstyle.xml @@ -137,6 +130,16 @@ org.apache.maven.plugins maven-javadoc-plugin ${maven.javadoc.version} + + true + + + org.checkerframework + checker-qual + https://checkerframework.org/api + + + attach-javadocs @@ -222,12 +225,6 @@ true - - org.projectlombok - lombok - ${maven.lombok.version} - - org.checkerframework checker @@ -238,14 +235,6 @@ org.checkerframework.checker.nullness.NullnessChecker org.checkerframework.checker.resourceleak.ResourceLeakChecker - - - lombok.launch.AnnotationProcessorHider$AnnotationProcessor - lombok.launch.AnnotationProcessorHider$ClaimingProcessor -Xmaxerrs