From a0c6364349d1d2c1d10f677e47d6d9dd045ed67e Mon Sep 17 00:00:00 2001
From: Haotian Zhang <928016560@qq.com>
Date: Tue, 8 Jul 2025 17:53:15 +0800
Subject: [PATCH] docs:update maven publish.
---
.github/workflows/codecov.yml | 36 -----
.github/workflows/junit.yml | 88 ++++++++++++
.github/workflows/junit_test.yml | 46 ------
.github/workflows/license-checker.yml | 22 +--
.github/workflows/release.yml | 13 +-
.github/workflows/snapshot.yml | 60 ++++++--
.licenserc.yaml | 4 +-
pom.xml | 168 ++++++++++++++--------
spring-cloud-tencent-dependencies/pom.xml | 87 ++++++-----
9 files changed, 320 insertions(+), 204 deletions(-)
delete mode 100644 .github/workflows/codecov.yml
create mode 100644 .github/workflows/junit.yml
delete mode 100644 .github/workflows/junit_test.yml
diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml
deleted file mode 100644
index 011787bdb..000000000
--- a/.github/workflows/codecov.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-name: Codecov
-
-on:
- push:
- branches:
- - 2022.0
- - 2021.0
- - 2020.0
- - hoxton
- - greenwich
- pull_request:
- branches:
- - 2022.0
- - 2021.0
- - 2020.0
- - hoxton
- - greenwich
-
-jobs:
- codecov:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout codes
- uses: actions/checkout@v3
- - name: Set up JDK 17
- uses: actions/setup-java@v3
- with:
- distribution: 'temurin'
- java-version: 17
- - name: Test with Maven
- run: mvn clean test -B -U -Psonatype
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
- with:
- files: ${{ github.workspace }}/target/site/jacoco/jacoco.xml
diff --git a/.github/workflows/junit.yml b/.github/workflows/junit.yml
new file mode 100644
index 000000000..91ab31e55
--- /dev/null
+++ b/.github/workflows/junit.yml
@@ -0,0 +1,88 @@
+name: Junit Test
+
+on:
+ push:
+ branches:
+ - 2024
+ - 2023
+ - 2022
+ - 2021
+ - 2020
+ - hoxton
+ - greenwich
+ - release/*
+ pull_request:
+ branches:
+ - 2024
+ - 2023
+ - 2022
+ - 2021
+ - 2020
+ - hoxton
+ - greenwich
+ - release/*
+
+jobs:
+ set-jdks:
+ runs-on: ubuntu-latest
+ outputs:
+ jdks: ${{ steps.set-jdks.outputs.jdks }}
+ steps:
+ - name: Set JDK matrix based on branch
+ id: set-jdks
+ run: |
+ shopt -s nocasematch
+ branch_name=${{ github.ref_name }}
+ if [ -n "${{ github.base_ref }}" ]; then
+ branch_name=${{ github.base_ref }}
+ fi
+ echo $branch_name
+ if [[ "$branch_name" == "2024" ]]; then
+ echo "jdks=[17,21]" >> $GITHUB_OUTPUT
+ elif [[ "$branch_name" == "2023" ]]; then
+ echo "jdks=[17,21]" >> $GITHUB_OUTPUT
+ elif [[ "$branch_name" == "2022" ]]; then
+ echo "jdks=[17,21]" >> $GITHUB_OUTPUT
+ elif [[ "$branch_name" == "2021" ]]; then
+ echo "jdks=[8,11,17,21]" >> $GITHUB_OUTPUT
+ elif [[ "$branch_name" == "2020" ]]; then
+ echo "jdks=[8,11,17,21]" >> $GITHUB_OUTPUT
+ elif [[ "$branch_name" == "hoxton" ]]; then
+ echo "jdks=[8,11,17]" >> $GITHUB_OUTPUT
+ elif [[ "$branch_name" == "greenwich" ]]; then
+ echo "jdks=[8,11]" >> $GITHUB_OUTPUT
+ else
+ echo "jdks=[17]" >> $GITHUB_OUTPUT
+ fi
+ shopt -u nocasematch
+ junit:
+ strategy:
+ matrix:
+ java: ${{ fromJson(needs.set-jdks.outputs.jdks) }}
+ os: [ 'windows-latest', 'ubuntu-latest' ]
+ runs-on: ${{ matrix.os }}
+ needs: set-jdks
+ steps:
+ - name: Checkout codes
+ uses: actions/checkout@v4
+ - name: Set up JDK ${{ matrix.java }}
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'temurin'
+ java-version: ${{ matrix.java }}
+ - name: Cache local Maven repository
+ uses: actions/cache@v4
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+ - name: Test with Maven
+ run: mvn clean test -B -U -Psonatype
+ - name: Upload coverage to Codecov
+ if: matrix.os == 'ubuntu-latest' && matrix.java == 17
+ uses: codecov/codecov-action@v4
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+ with:
+ files: ${{ github.workspace }}/target/site/jacoco/jacoco.xml
\ No newline at end of file
diff --git a/.github/workflows/junit_test.yml b/.github/workflows/junit_test.yml
deleted file mode 100644
index c26f1d8be..000000000
--- a/.github/workflows/junit_test.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-# 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: Test with Junit
-
-on:
- push:
- branches:
- - hoxton
- - 2021.0
- - 2020.0
- - greenwich
- pull_request:
- branches:
- - hoxton
- - 2021.0
- - 2020.0
- - greenwich
-
-jobs:
- junit:
- strategy:
- matrix:
- java: [ 8, 11, 17 ]
- os: [ 'windows-latest', 'ubuntu-latest' ]
-
- runs-on: ${{ matrix.os }}
-
- steps:
- - name: Checkout codes
- uses: actions/checkout@v3
- - name: Set up JDK ${{ matrix.java }}
- uses: actions/setup-java@v3
- with:
- distribution: 'temurin'
- java-version: ${{ matrix.java }}
- - name: Cache local Maven repository
- uses: actions/cache@v3
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- restore-keys: |
- ${{ runner.os }}-maven-
- - name: Test with Maven
- run: mvn clean test -B -U -Psonatype
-
diff --git a/.github/workflows/license-checker.yml b/.github/workflows/license-checker.yml
index e5e639135..aacc989ca 100644
--- a/.github/workflows/license-checker.yml
+++ b/.github/workflows/license-checker.yml
@@ -3,23 +3,29 @@ name: License checker
on:
push:
branches:
- - 2022.0
- - 2021.0
- - 2020.0
+ - 2024
+ - 2023
+ - 2022
+ - 2021
+ - 2020
- hoxton
- greenwich
+ - release/*
pull_request:
branches:
- - 2022.0
- - 2021.0
- - 2020.0
+ - 2024
+ - 2023
+ - 2022
+ - 2021
+ - 2020
- hoxton
- greenwich
+ - release/*
jobs:
check-license:
runs-on: ubuntu-latest
steps:
- name: Checkout codes
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Check License Header
- uses: apache/skywalking-eyes@v0.4.0
+ uses: apache/skywalking-eyes@v0.4.0
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 49f492d07..ae2a08218 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -8,20 +8,21 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Set up JDK 17
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- server-id: nexus-releases
+ server-id: central-portal
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
env:
- MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
- MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
+ MAVEN_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.CENTRAL_PORTAL_TOKEN }}
+ MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
run: |
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import;
- mvn clean deploy -U -P release -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} -DskipTests
\ No newline at end of file
+ mvn clean deploy -B -U -P release -Dmaven.test.skip=true
\ No newline at end of file
diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml
index 1809ba7c6..6432d510a 100644
--- a/.github/workflows/snapshot.yml
+++ b/.github/workflows/snapshot.yml
@@ -3,22 +3,25 @@ name: Snapshot
on:
push:
branches:
- - 2022.0
- - 2021.0
- - 2020.0
+ - 2024
+ - 2023
+ - 2022
+ - 2021
+ - 2020
- hoxton
- greenwich
+ - release/*
jobs:
check-snapshot:
runs-on: ubuntu-latest
outputs:
- IS_SNAPSHOT: ${{ steps.set_output_1.outputs.IS_SNAPSHOT }}
+ IS_SNAPSHOT: ${{ steps.check-deploy-type.outputs.IS_SNAPSHOT }}
steps:
- name: Checkout codes
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Check deploy type
- id: set_output_1
+ id: check-deploy-type
run: |
line="$(grep SNAPSHOT pom.xml || true)"
echo $line
@@ -27,23 +30,50 @@ jobs:
else
echo "IS_SNAPSHOT=false" >> $GITHUB_OUTPUT
fi
+ set-jdk:
+ runs-on: ubuntu-latest
+ outputs:
+ jdk: ${{ steps.set-jdk.outputs.jdk }}
+ steps:
+ - name: Set JDK based on branch
+ id: set-jdk
+ run: |
+ shopt -s nocasematch
+ if [[ "${{ github.ref_name }}" == "2024" ]]; then
+ echo "jdk=17" >> $GITHUB_OUTPUT
+ elif [[ "${{ github.ref_name }}" == "2023" ]]; then
+ echo "jdk=17" >> $GITHUB_OUTPUT
+ elif [[ "${{ github.ref_name }}" == "2022" ]]; then
+ echo "jdk=17" >> $GITHUB_OUTPUT
+ elif [[ "${{ github.ref_name }}" == "2021" ]]; then
+ echo "jdk=8" >> $GITHUB_OUTPUT
+ elif [[ "${{ github.ref_name }}" == "2020" ]]; then
+ echo "jdk=8" >> $GITHUB_OUTPUT
+ elif [[ "${{ github.ref_name }}" == "hoxton" ]]; then
+ echo "jdk=8" >> $GITHUB_OUTPUT
+ elif [[ "${{ github.ref_name }}" == "greenwich" ]]; then
+ echo "jdk=8" >> $GITHUB_OUTPUT
+ else
+ echo "jdk=17" >> $GITHUB_OUTPUT
+ fi
+ shopt -u nocasematch
snapshot:
runs-on: ubuntu-latest
- needs: check-snapshot
+ needs: [ check-snapshot, set-jdk ]
if: ${{ needs.check-snapshot.outputs.IS_SNAPSHOT == 'true' }}
steps:
- name: Checkout codes
- uses: actions/checkout@v3
- - name: Set up JDK 17
- uses: actions/setup-java@v3
+ uses: actions/checkout@v4
+ - name: Set up JDK ${{ needs.set-jdk.outputs.jdk }}
+ uses: actions/setup-java@v4
with:
- java-version: '17'
+ java-version: ${{ needs.set-jdk.outputs.jdk }}
distribution: 'temurin'
- server-id: nexus-snapshots
+ server-id: central-portal
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
- run: mvn clean deploy -B -U -Psonatype
+ run: mvn clean deploy -B -U -Dmaven.test.skip=true
env:
- MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
- MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
\ No newline at end of file
+ MAVEN_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.CENTRAL_PORTAL_TOKEN }}
\ No newline at end of file
diff --git a/.licenserc.yaml b/.licenserc.yaml
index b2f072ff7..a553a4ee7 100644
--- a/.licenserc.yaml
+++ b/.licenserc.yaml
@@ -1,7 +1,7 @@
header:
license:
content: |
- Tencent is pleased to support the open source community by making Spring Cloud Tencent available.
+ Tencent is pleased to support the open source community by making spring-cloud-tencent available.
Copyright (C) 2021 Tencent. All rights reserved.
@@ -20,4 +20,4 @@ header:
language:
Java:
extensions:
- - ".java"
+ - ".java"
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index d307e02b9..f068f7721 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
${revision}
Spring Cloud Tencent
Spring Cloud Tencent
- https://github.com/Tencent/spring-cloud-tencent/tree/2021.0
+ https://github.com/Tencent/spring-cloud-tencent/tree/2021
Tencent
@@ -26,7 +26,7 @@
The BSD 3-Clause License (BSD3)
- https://raw.githubusercontent.com/Tencent/spring-cloud-tencent/2021.0/LICENSE
+ https://raw.githubusercontent.com/Tencent/spring-cloud-tencent/2021/LICENSE
repo
@@ -106,6 +106,8 @@
1.2.7
3.0.1
3.4.1
+ 3.4.0
+ 0.8.0
true
@@ -174,6 +176,21 @@
org.apache.maven.plugins
maven-checkstyle-plugin
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+ ${maven-clean-plugin.version}
+
+
+
+ ${project.basedir}
+
+ dependency-reduced-pom.xml
+
+
+
+
+
org.apache.maven.plugins
maven-compiler-plugin
@@ -214,6 +231,31 @@
${argLine}
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ ${maven-source-plugin.version}
+
+
+ package
+
+ jar-no-fork
+
+
+
+
org.codehaus.mojo
flatten-maven-plugin
@@ -256,33 +298,6 @@
release
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- ${maven-source-plugin.version}
-
-
- package
-
- jar-no-fork
-
-
-
-
-
org.apache.maven.plugins
maven-gpg-plugin
@@ -297,45 +312,80 @@
+
+ org.sonatype.central
+ central-publishing-maven-plugin
+ ${central.publishing.maven.plugin.version}
+ true
+
+ central-portal
+
+ spring-cloud-tencent-coverage
+ spring-cloud-tencent-examples
+ metadata-transfer-example
+ metadata-backend
+ metadata-frontend
+ metadata-middle
+ multiple-discovery-example
+ multiple-discovery-nacos-example
+ nacos-callee-service-a
+ nacos-callee-service-b
+ nacos-discovery-caller
+ polaris-config-data-example
+ polaris-router-featureenv-example
+ base
+ base-backend
+ base-front
+ base-middle
+ feature1
+ feature1-backend
+ feature1-middle
+ feature2
+ feature2-backend
+ feature2-front
+ featureenv-gateway
+ polaris-router-grayrelease-example
+ router-grayrelease-backend
+ router-grayrelease-frontend
+ router-grayrelease-gateway
+ router-grayrelease-middle
+ quickstart-example
+ quickstart-callee-service-a
+ quickstart-callee-service-b
+ quickstart-caller-service
+ quickstart-gateway-service
+ quickstart-zuul-service
+
+
+
-
- sonatype
-
-
- nexus-snapshots
- https://oss.sonatype.org/content/repositories/snapshots
-
- false
-
-
- true
- always
-
-
-
- nexus-releases
- https://oss.sonatype.org/service/local/staging/deploy/maven2
-
- true
-
-
- false
-
-
-
-
- nexus-snapshots
- https://oss.sonatype.org/content/repositories/snapshots/
+ central-portal
+ https://central.sonatype.com/repository/maven-snapshots/
- nexus-releases
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
+ central-portal
+ https://ossrh-staging-api.central.sonatype.com/service/local/
+
+
+
+ Central Portal Snapshots
+ central-portal-snapshots
+ https://central.sonatype.com/repository/maven-snapshots/
+
+ false
+
+
+ true
+ always
+
+
+
diff --git a/spring-cloud-tencent-dependencies/pom.xml b/spring-cloud-tencent-dependencies/pom.xml
index f61ad9f44..515d39d32 100644
--- a/spring-cloud-tencent-dependencies/pom.xml
+++ b/spring-cloud-tencent-dependencies/pom.xml
@@ -88,6 +88,7 @@
3.2.0
1.2.7
3.0.1
+ 0.8.0
@@ -270,6 +271,32 @@
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${maven-javadoc-plugin.verison}
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ ${maven-source-plugin.version}
+
+
+ package
+
+ jar-no-fork
+
+
+
+
org.codehaus.mojo
flatten-maven-plugin
@@ -303,34 +330,6 @@
release
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- ${maven-javadoc-plugin.verison}
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- ${maven-source-plugin.version}
-
-
- package
-
- jar-no-fork
-
-
-
-
-
org.apache.maven.plugins
maven-gpg-plugin
@@ -344,6 +343,15 @@
+
+ org.sonatype.central
+ central-publishing-maven-plugin
+ ${central.publishing.maven.plugin.version}
+ true
+
+ central-portal
+
+
@@ -351,12 +359,27 @@
- nexus-snapshots
- https://oss.sonatype.org/content/repositories/snapshots/
+ central-portal
+ https://central.sonatype.com/repository/maven-snapshots/
- nexus-releases
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
+ central-portal
+ https://ossrh-staging-api.central.sonatype.com/service/local/
+
+
+
+ Central Portal Snapshots
+ central-portal-snapshots
+ https://central.sonatype.com/repository/maven-snapshots/
+
+ false
+
+
+ true
+ always
+
+
+