Skip to content

Commit 1cad5c7

Browse files
committed
ci: fix check
1 parent 1c7246f commit 1cad5c7

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

.github/workflows/deploy.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
name: Deploy and Publish
88

99
on:
10-
workflow_run:
11-
workflows: ["Build and Test"]
10+
push:
11+
branches: [ '**' ]
12+
pull_request:
1213
branches: [ master ]
13-
types:
14-
- completed
1514

1615
# Allows you to run this workflow manually from the Actions tab
1716
workflow_dispatch:
@@ -59,15 +58,22 @@ jobs:
5958
npm install -g @semantic-release/commit-analyzer
6059
npm install -g @semantic-release/release-notes-generator
6160
61+
- name: Check if semantic release generated a release
62+
id: is_new_release
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
65+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
66+
run: echo ::set-output name=IS_NEW_RELEASE::$(npx semantic-release --dry-run --branches 9662_addcheck | grep -c -i "Published release")
67+
6268
- name: Publish to Git Releases and Tags
63-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
69+
if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1' }}
6470
env:
6571
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
6672
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
67-
run: npx semantic-release # --dry-run --branches 9520_gha
73+
run: npx semantic-release --dry-run --branches 9662_addcheck
6874

6975
- name: Publish to Maven Central
70-
if: startsWith(github.ref, 'refs/tags/v')
76+
if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1' }}
7177
env:
7278
GHA_TAG: ${{ github.ref }} # non PR only need to get last part
7379
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} # for .travis.settings.xml
@@ -78,7 +84,7 @@ jobs:
7884
mvn deploy --settings build/.travis.settings.xml -DskipITs -Dskip.unit.tests -P central $MVN_ARGS
7985
8086
- name: Publish Java docs
81-
if: startsWith(github.ref, 'refs/tags/v')
87+
if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1' }}
8288
env:
8389
GH_TOKEN: ${{ secrets.GH_TOKEN }}
8490
GHA_REPO_SLUG: ${{ github.repository }}
@@ -92,3 +98,8 @@ jobs:
9298
build/setMavenVersion_gha.sh
9399
mvn clean javadoc:aggregate $MVN_ARGS
94100
build/publish_gha.sh
101+
102+
- name: SKIP - Publish/Deploy to Git and Maven Central
103+
if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '0' }}
104+
run: |
105+
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

Comments
 (0)