@@ -59,15 +59,22 @@ jobs:
5959 npm install -g @semantic-release/commit-analyzer
6060 npm install -g @semantic-release/release-notes-generator
6161
62+ - name : Check if semantic release generated a release
63+ id : is_new_release
64+ env :
65+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
66+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
67+ run : echo ::set-output name=IS_NEW_RELEASE::$(npx semantic-release --dry-run | grep -c -i "Published release")
68+
6269 - name : Publish to Git Releases and Tags
63- if : ${{ github.event.workflow_run.conclusion == 'success ' }}
70+ if : ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1 ' }}
6471 env :
6572 GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
6673 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
67- run : npx semantic-release # --dry-run --branches 9520_gha
74+ run : npx semantic-release # --dry-run --branches 9662_addcheck
6875
6976 - name : Publish to Maven Central
70- if : startsWith(github.ref, 'refs/tags/v')
77+ if : ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1' }}
7178 env :
7279 GHA_TAG : ${{ github.ref }} # non PR only need to get last part
7380 OSSRH_USERNAME : ${{ secrets.OSSRH_USERNAME }} # for .travis.settings.xml
7885 mvn deploy --settings build/.travis.settings.xml -DskipITs -Dskip.unit.tests -P central $MVN_ARGS
7986
8087 - name : Publish Java docs
81- if : startsWith(github.ref, 'refs/tags/v')
88+ if : ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1' }}
8289 env :
8390 GH_TOKEN : ${{ secrets.GH_TOKEN }}
8491 GHA_REPO_SLUG : ${{ github.repository }}
9299 build/setMavenVersion_gha.sh
93100 mvn clean javadoc:aggregate $MVN_ARGS
94101 build/publish_gha.sh
102+
103+ - name : SKIP - Publish/Deploy to Git and Maven Central
104+ if : ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '0' }}
105+ run : |
106+ echo -e "\n\033[0;35mCommand: Skipping the deployment because semantic release has determined there are no relevant changes that warrent a new release.\n"
0 commit comments