docs:update maven publish.

Haotian Zhang 2 months ago
parent d8252f3cc4
commit a0c6364349

@ -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

@ -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

@ -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

@ -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

@ -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
mvn clean deploy -B -U -P release -Dmaven.test.skip=true

@ -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 }}
MAVEN_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PORTAL_TOKEN }}

@ -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"

@ -16,7 +16,7 @@
<version>${revision}</version>
<name>Spring Cloud Tencent</name>
<description>Spring Cloud Tencent</description>
<url>https://github.com/Tencent/spring-cloud-tencent/tree/2021.0</url>
<url>https://github.com/Tencent/spring-cloud-tencent/tree/2021</url>
<organization>
<name>Tencent</name>
@ -26,7 +26,7 @@
<licenses>
<license>
<name>The BSD 3-Clause License (BSD3)</name>
<url>https://raw.githubusercontent.com/Tencent/spring-cloud-tencent/2021.0/LICENSE</url>
<url>https://raw.githubusercontent.com/Tencent/spring-cloud-tencent/2021/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
@ -106,6 +106,8 @@
<flatten-maven-plugin.version>1.2.7</flatten-maven-plugin.version>
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>
<maven-clean-plugin.version>3.4.0</maven-clean-plugin.version>
<central.publishing.maven.plugin.version>0.8.0</central.publishing.maven.plugin.version>
<!-- Checkstyle -->
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
@ -174,6 +176,21 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}</directory>
<includes>
<include>dependency-reduced-pom.xml</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@ -214,6 +231,31 @@
<argLine>${argLine}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
@ -256,33 +298,6 @@
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
@ -297,45 +312,80 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${central.publishing.maven.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central-portal</publishingServerId>
<excludeArtifacts>
<excludeArtifact>spring-cloud-tencent-coverage</excludeArtifact>
<excludeArtifact>spring-cloud-tencent-examples</excludeArtifact>
<excludeArtifact>metadata-transfer-example</excludeArtifact>
<excludeArtifact>metadata-backend</excludeArtifact>
<excludeArtifact>metadata-frontend</excludeArtifact>
<excludeArtifact>metadata-middle</excludeArtifact>
<excludeArtifact>multiple-discovery-example</excludeArtifact>
<excludeArtifact>multiple-discovery-nacos-example</excludeArtifact>
<excludeArtifact>nacos-callee-service-a</excludeArtifact>
<excludeArtifact>nacos-callee-service-b</excludeArtifact>
<excludeArtifact>nacos-discovery-caller</excludeArtifact>
<excludeArtifact>polaris-config-data-example</excludeArtifact>
<excludeArtifact>polaris-router-featureenv-example</excludeArtifact>
<excludeArtifact>base</excludeArtifact>
<excludeArtifact>base-backend</excludeArtifact>
<excludeArtifact>base-front</excludeArtifact>
<excludeArtifact>base-middle</excludeArtifact>
<excludeArtifact>feature1</excludeArtifact>
<excludeArtifact>feature1-backend</excludeArtifact>
<excludeArtifact>feature1-middle</excludeArtifact>
<excludeArtifact>feature2</excludeArtifact>
<excludeArtifact>feature2-backend</excludeArtifact>
<excludeArtifact>feature2-front</excludeArtifact>
<excludeArtifact>featureenv-gateway</excludeArtifact>
<excludeArtifact>polaris-router-grayrelease-example</excludeArtifact>
<excludeArtifact>router-grayrelease-backend</excludeArtifact>
<excludeArtifact>router-grayrelease-frontend</excludeArtifact>
<excludeArtifact>router-grayrelease-gateway</excludeArtifact>
<excludeArtifact>router-grayrelease-middle</excludeArtifact>
<excludeArtifact>quickstart-example</excludeArtifact>
<excludeArtifact>quickstart-callee-service-a</excludeArtifact>
<excludeArtifact>quickstart-callee-service-b</excludeArtifact>
<excludeArtifact>quickstart-caller-service</excludeArtifact>
<excludeArtifact>quickstart-gateway-service</excludeArtifact>
<excludeArtifact>quickstart-zuul-service</excludeArtifact>
</excludeArtifacts>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>sonatype</id>
<repositories>
<repository>
<id>nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<repository>
<id>nexus-releases</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<id>central-portal</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<id>central-portal</id>
<url>https://ossrh-staging-api.central.sonatype.com/service/local/</url>
</repository>
</distributionManagement>
<repositories>
<repository>
<name>Central Portal Snapshots</name>
<id>central-portal-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</project>

@ -88,6 +88,7 @@
<maven-source-plugin.version>3.2.0</maven-source-plugin.version>
<flatten-maven-plugin.version>1.2.7</flatten-maven-plugin.version>
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<central.publishing.maven.plugin.version>0.8.0</central.publishing.maven.plugin.version>
</properties>
<dependencyManagement>
@ -270,6 +271,32 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.verison}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
@ -303,34 +330,6 @@
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.verison}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
@ -344,6 +343,15 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${central.publishing.maven.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central-portal</publishingServerId>
</configuration>
</plugin>
</plugins>
</build>
</profile>
@ -351,12 +359,27 @@
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<id>central-portal</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<id>central-portal</id>
<url>https://ossrh-staging-api.central.sonatype.com/service/local/</url>
</repository>
</distributionManagement>
<repositories>
<repository>
<name>Central Portal Snapshots</name>
<id>central-portal-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</project>

Loading…
Cancel
Save