From 92b6600223fba475e404e1b3644fdd8f735bc135 Mon Sep 17 00:00:00 2001 From: Haotian Zhang <928016560@qq.com> Date: Fri, 19 May 2023 19:30:51 +0800 Subject: [PATCH] docs:add release GitHub Action. (#1008) --- .github/workflows/release.yml | 27 +++++++++++++++++++ CHANGELOG.md | 1 + .../context/PolarisSDKContextManager.java | 6 +++-- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..49f492d07 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: Release + +on: + release: + types: [ published ] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + server-id: nexus-releases + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + + - name: Publish package + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index bf3c972d9..9bf5d4acb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,3 +6,4 @@ - [Feature: add AssemblyFlow to support tsf.](https://github.com/Tencent/spring-cloud-tencent/pull/994) - [Refactoring: Refactor Circuitbreaker ut.](https://github.com/Tencent/spring-cloud-tencent/pull/998) - [feat:refactor SDKContext as static.](https://github.com/Tencent/spring-cloud-tencent/pull/1005) +- [docs:add release GitHub Action.](https://github.com/Tencent/spring-cloud-tencent/pull/1008) diff --git a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PolarisSDKContextManager.java b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PolarisSDKContextManager.java index e72abefd2..e28a60770 100644 --- a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PolarisSDKContextManager.java +++ b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PolarisSDKContextManager.java @@ -111,8 +111,10 @@ public class PolarisSDKContextManager { assemblyAPI = null; } - sdkContext.destroy(); - sdkContext = null; + if (Objects.nonNull(sdkContext)) { + sdkContext.destroy(); + sdkContext = null; + } LOG.info("Polaris SDK context is destroyed."); } catch (Throwable throwable) {