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
0 commit comments