Skip to content

Commit a27d6f4

Browse files
authored
Merge pull request #1186 from watson-developer-cloud/9662_addcheck
ci: 9662 addcheck
2 parents 1c7246f + d722166 commit a27d6f4

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.github/workflows/deploy.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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
@@ -78,7 +85,7 @@ jobs:
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 }}
@@ -92,3 +99,8 @@ jobs:
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

Comments
 (0)