From d2ea95f78e20ac42034b99e0d0f691128e5f6960 Mon Sep 17 00:00:00 2001 From: Liao Xin <93535922+liewstar@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:37:43 +0800 Subject: [PATCH] feat: automatically publish to Maven repository (#5) * feat: automatically publish to Maven repository * fix: add Codecov in CI --- .github/workflows/maven-ci.yml | 51 ++++++++++ maven-settings.xml | 22 +++++ pom.xml | 167 ++++++++++++++++++++++++++++++++- 3 files changed, 239 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/maven-ci.yml create mode 100644 maven-settings.xml diff --git a/.github/workflows/maven-ci.yml b/.github/workflows/maven-ci.yml new file mode 100644 index 0000000..cb5502b --- /dev/null +++ b/.github/workflows/maven-ci.yml @@ -0,0 +1,51 @@ +# This workflow will build a Java project with Maven +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Java CI with Maven + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: '0' + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + server-id: ossrh + server-username: OSSRH_JIRA_USERNAME + server-password: OSSRH_JIRA_PASSWORD + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: GPG_PASSPHRASE + + - name: Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Build with Maven + run: mvn clean test + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 20 + + - name: Semantic Release + run: | + npm install -g @conveyal/maven-semantic-release semantic-release + semantic-release --prepare @conveyal/maven-semantic-release --publish @semantic-release/github,@conveyal/maven-semantic-release --verify-conditions @semantic-release/github,@conveyal/maven-semantic-release --verify-release @conveyal/maven-semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + OSSRH_JIRA_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }} + OSSRH_JIRA_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }} \ No newline at end of file diff --git a/maven-settings.xml b/maven-settings.xml new file mode 100644 index 0000000..9600d94 --- /dev/null +++ b/maven-settings.xml @@ -0,0 +1,22 @@ + + + + ossrh + ${OSSRH_JIRA_USERNAME} + ${OSSRH_JIRA_PASSWORD} + + + + + ossrh + + true + + + gpg + ${GPG_KEY_NAME} + ${GPG_PASSPHRASE} + + + + diff --git a/pom.xml b/pom.xml index 1c506d0..71a381b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,49 @@ org.casbin kafka-casbin - 1.0-SNAPSHOT + 1.0 + + kafka-casbin + Kafka authorization plugin based on Casbin + https://github.com/jcasbin/kafka-casbin + 2021 + + + Github + https://github.com/jcasbin/kafka-casbin/issues + + + + org.sonatype.oss + oss-parent + 7 + + + + The Apache Software License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + https://github.com/jcasbin/kafka-casbin + git@github.com:jcasbin/kafka-casbin.git + https://github.com/hsluoyz + + + + Yang Luo + hsluoyz@qq.com + https://github.com/hsluoyz + + + + + + ossrh + https://central.sonatype.com + + 8 @@ -63,4 +105,127 @@ + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + --pinentry-mode + loopback + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 11 + false + + -Xdoclint:none + + + notnull + a + Not null + + + default + a + Default: + + + + + + + attach-javadocs + + jar + + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar-no-fork + + + + + + + org.sonatype.central + central-publishing-maven-plugin + 0.5.0 + true + + ossrh + true + + true + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.7 + + + html + xml + + + + + + org.eluder.coveralls + coveralls-maven-plugin + 4.3.0 + + + org.jacoco + jacoco-maven-plugin + 0.7.6.201602180812 + + + prepare-agent + + prepare-agent + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + \ No newline at end of file