From aa2e4a71c2b71e5e4076ecbae488cb93fb81db1f Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Tue, 13 May 2025 11:58:21 +0800 Subject: [PATCH 1/5] add maven-publish github action --- .github/workflows/maven-publish.yml | 57 +++++++++++++++++++++++++++++ pom.xml | 11 +++--- 2 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/maven-publish.yml diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..8922079 --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,57 @@ +name: Publish to Maven Central +on: + push: + branches: + - main + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + steps: + # 检出代码 + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # 设置所需的Java版本 + - name: Set up Java + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + server-id: central + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + cache: maven + + - name: Verify GPG keys + run: | + echo "Available GPG Keys:" + gpg --list-secret-keys --keyid-format LONG + + - name: Generate version && Set version + id: set_version + run: | + git describe --tags 2>/dev/null || echo "no tag" + TIMESTAMP=$(date +'%Y%m%d.%H%M%S') + GIT_DESCRIBE=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.1") + VERSION="${GIT_DESCRIBE}-${TIMESTAMP}" + echo "Generated version: $VERSION" + mvn versions:set -DnewVersion=$VERSION --no-transfer-progress + env: + TZ: Asia/Shanghai + + - name: Publish to Maven Central + run: | + mvn clean deploy -P release \ + -Dmaven.test.skip=true \ + -Dgpg.args="--batch --yes --pinentry-mode loopback" \ + --no-transfer-progress + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} diff --git a/pom.xml b/pom.xml index 6a8edf1..9a7c828 100644 --- a/pom.xml +++ b/pom.xml @@ -172,14 +172,13 @@ - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.3 + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 true - ossrh - https://oss.sonatype.org/ - true + central + true From ff905cf9f4d5bdc5619927d7478381555460e736 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Tue, 13 May 2025 12:09:50 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=8D=87=E7=BA=A7maven-gpg-plugin=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9a7c828..c579e13 100644 --- a/pom.xml +++ b/pom.xml @@ -140,7 +140,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.1.0 sign-artifacts From 159a93befcae946c6fc8e27839da4b2b23dfa4fb Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Tue, 13 May 2025 12:13:19 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=BA=9B=E6=B2=A1?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E4=B8=9C=E8=A5=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index c579e13..3750412 100644 --- a/pom.xml +++ b/pom.xml @@ -80,17 +80,6 @@ - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - doclint-java8-disable @@ -177,6 +166,7 @@ 0.7.0 true + Release ${project.version} (Maven) central true From 2189377af82ff2ebd2b0bdf70b582d77faecd126 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Tue, 13 May 2025 12:20:47 +0800 Subject: [PATCH 4/5] updat deploymentName --- README.md | 11 ++++++++++- pom.xml | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cb50553..af7786c 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,15 @@ Maven 引用方式 com.github.binarywang java-testdata-generator -    1.1.2 + 1.1.2 ```` + + +```shell +git add . +git commit -m "updat deploymentName" + +git pull --rebase +git push origin +``` diff --git a/pom.xml b/pom.xml index 3750412..57eb8a8 100644 --- a/pom.xml +++ b/pom.xml @@ -166,7 +166,7 @@ 0.7.0 true - Release ${project.version} (Maven) + Release ${project.artifactId}:${project.version} central true From 6923e521f3ece2cc99269e9b6f6387e6aab54451 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 12 Jul 2025 00:57:51 +0000 Subject: [PATCH 5/5] Bump org.apache.commons:commons-lang3 from 3.10 to 3.18.0 Bumps org.apache.commons:commons-lang3 from 3.10 to 3.18.0. --- updated-dependencies: - dependency-name: org.apache.commons:commons-lang3 dependency-version: 3.18.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 57eb8a8..b2d3665 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ org.apache.commons commons-lang3 - 3.10 + 3.18.0 joda-time