|
7 | 7 | name: Deploy and Publish |
8 | 8 |
|
9 | 9 | on: |
10 | | - workflow_run: |
11 | | - workflows: ["Build and Test"] |
| 10 | + push: |
| 11 | + branches: [ '**' ] |
| 12 | + pull_request: |
12 | 13 | branches: [ master ] |
13 | | - types: |
14 | | - - completed |
15 | 14 |
|
16 | 15 | # Allows you to run this workflow manually from the Actions tab |
17 | 16 | workflow_dispatch: |
@@ -59,15 +58,22 @@ jobs: |
59 | 58 | npm install -g @semantic-release/commit-analyzer |
60 | 59 | npm install -g @semantic-release/release-notes-generator |
61 | 60 |
|
| 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 | + |
62 | 68 | - 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' }} |
64 | 70 | env: |
65 | 71 | GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
66 | 72 | 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 |
68 | 74 |
|
69 | 75 | - name: Publish to Maven Central |
70 | | - if: startsWith(github.ref, 'refs/tags/v') |
| 76 | + if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1' }} |
71 | 77 | env: |
72 | 78 | GHA_TAG: ${{ github.ref }} # non PR only need to get last part |
73 | 79 | OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} # for .travis.settings.xml |
|
78 | 84 | mvn deploy --settings build/.travis.settings.xml -DskipITs -Dskip.unit.tests -P central $MVN_ARGS |
79 | 85 |
|
80 | 86 | - name: Publish Java docs |
81 | | - if: startsWith(github.ref, 'refs/tags/v') |
| 87 | + if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1' }} |
82 | 88 | env: |
83 | 89 | GH_TOKEN: ${{ secrets.GH_TOKEN }} |
84 | 90 | GHA_REPO_SLUG: ${{ github.repository }} |
|
92 | 98 | build/setMavenVersion_gha.sh |
93 | 99 | mvn clean javadoc:aggregate $MVN_ARGS |
94 | 100 | 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