Skip to content

Commit 74f3545

Browse files
author
fengyikai
committed
feat: 合并 release 和 publish workflows
1 parent f2e9c05 commit 74f3545

3 files changed

Lines changed: 42 additions & 34 deletions

File tree

.github/workflows/maven-publish.yml

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,41 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v2
11+
with:
12+
fetch-depth: 0
13+
14+
- name: Extract version from pom.xml
15+
id: get_version
16+
run: |
17+
VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/')
18+
echo "version=$VERSION" >> $GITHUB_OUTPUT
19+
echo "Detected version: $VERSION"
20+
21+
- name: Check if tag exists
22+
id: check_tag
23+
run: |
24+
if git rev-parse "v${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then
25+
echo "exists=true" >> $GITHUB_OUTPUT
26+
echo "Tag v${{ steps.get_version.outputs.version }} already exists"
27+
else
28+
echo "exists=false" >> $GITHUB_OUTPUT
29+
echo "Tag v${{ steps.get_version.outputs.version }} does not exist"
30+
fi
31+
32+
- name: Create Release
33+
id: create_release
34+
if: steps.check_tag.outputs.exists == 'false'
35+
uses: actions/create-release@v1
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
with:
39+
tag_name: v${{ steps.get_version.outputs.version }}
40+
release_name: Release v${{ steps.get_version.outputs.version }}
41+
body: |
42+
Auto-generated release for version ${{ steps.get_version.outputs.version }}
43+
draft: false
44+
prerelease: false
45+
1146
- name: Set up Maven Central Repository
1247
uses: actions/setup-java@v2
1348
with:
@@ -16,13 +51,15 @@ jobs:
1651
server-id: central
1752
server-username: MAVEN_USERNAME
1853
server-password: MAVEN_PASSWORD
19-
- id: install-secret-key
20-
name: Install gpg secret key
54+
55+
- name: Install gpg secret key
2156
run: |
2257
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
2358
gpg --list-secret-keys
59+
2460
- name: Publish package
2561
env:
2662
MAVEN_USERNAME: ${{ secrets.mvn_central_portal_user_name }}
2763
MAVEN_PASSWORD: ${{ secrets.mvn_central_portal_password }}
28-
run: mvn clean deploy --batch-mode -Dgpg.passphrase=ksyun@123! -Dmaven.skip.Test=true
64+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
65+
run: mvn clean deploy --batch-mode -Dmaven.skip.Test=true

.github/workflows/maven-publish_setting.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.ksyun</groupId>
88
<artifactId>ksyun-java-sdk</artifactId>
9-
<version>1.8.6.30</version>
9+
<version>1.8.6.31</version>
1010
<packaging>jar</packaging>
1111

1212
<name>KSYUN SDK for Java</name>
@@ -225,6 +225,7 @@
225225
<extensions>true</extensions>
226226
<configuration>
227227
<publishingServerId>central</publishingServerId>
228+
<autoPublish>true</autoPublish>
228229
</configuration>
229230
</plugin>
230231

0 commit comments

Comments
 (0)