Skip to content

Commit 9fbd285

Browse files
authored
Update ci.yml
1 parent 3e231e6 commit 9fbd285

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,42 @@ jobs:
1414
environment: gaussdb-flink-connector-jdbc-build
1515
steps:
1616
- uses: actions/checkout@v4
17+
1718
- name: Set up JDK 17
1819
uses: actions/setup-java@v4
1920
with:
2021
java-version: 17
2122
distribution: adopt
2223
cache: maven
24+
# 添加 server 配置,这样就不需要自定义 settings.xml
25+
server-id: sonatype
26+
server-username: SONATYPE_USERNAME
27+
server-password: SONATYPE_PASSWORD
28+
gpg-private-key: ${{ secrets.GPG_KEY_BASE64 }}
29+
gpg-passphrase: GPG_PASSPHRASE
30+
2331
- name: Set up Maven
2432
uses: stCarolas/setup-maven@v5
2533
with:
2634
maven-version: 3.9.9
35+
2736
- uses: actions/cache@v4
2837
with:
2938
path: ~/.m2/repository
3039
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
3140
restore-keys: |
3241
${{ runner.os }}-maven-
33-
- name: Build with Maven
42+
43+
# 可选:验证 settings 是否正确
44+
- name: Verify Maven Settings
45+
run: |
46+
echo "Checking Maven settings"
47+
cat ~/.m2/settings.xml || echo "No settings.xml"
48+
49+
# 部署到 Sonatype - 使用 central profile(你的 pom.xml 中定义的)
50+
- name: Deploy to Sonatype
3451
env:
35-
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
52+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USER }}
3653
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
37-
GPG_KEY_BASE64: ${{ secrets.GPG_KEY_BASE64 }}
3854
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
39-
run: mvn -B deploy -P snapshot -s settings.xml
55+
run: mvn -B clean deploy -P central

0 commit comments

Comments
 (0)