From 171107fa9b66f54b176c5b16257290e6953c4d55 Mon Sep 17 00:00:00 2001 From: Yourui Date: Sat, 15 Jul 2023 12:47:12 -0400 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Deleted=20branches=20?= =?UTF-8?q?option=20from?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed main branch option from semantic release script --- .github/workflows/npmCD.yml | 19 +------------------ npm-package/package.json | 2 +- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/.github/workflows/npmCD.yml b/.github/workflows/npmCD.yml index 06bb53f..89dc0c9 100644 --- a/.github/workflows/npmCD.yml +++ b/.github/workflows/npmCD.yml @@ -12,15 +12,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - - name: Check if PR is merged - id: check_merge - run: | - if [[ "$(git log -1 --pretty=%B "${{ github.event.pull_request.merge_commit_sha }}")" == *"Merge pull request"* ]]; then - echo "is_merged=true" >> $GITHUB_ENV - else - echo "is_merged=false" >> $GITHUB_ENV - fi - - name: Setup node env uses: actions/setup-node@v3 with: @@ -31,16 +22,8 @@ jobs: - name: Build files into dist run: npm run build working-directory: ./npm-package - - name: Check for changes in npm-package - id: changes - run: | - if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.merge_commit_sha }} -- npm-package/ | grep -q .; then - echo "changes=true" >> $GITHUB_ENV - else - echo "changes=false" >> $GITHUB_ENV - fi - name: Deploy env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npm run semantic-release - if: steps.check_merge.outputs.is_merged == 'true' && steps.changes.outputs.changes == 'true' \ No newline at end of file + working-directory: ./npm-package \ No newline at end of file diff --git a/npm-package/package.json b/npm-package/package.json index 6691694..16945a5 100644 --- a/npm-package/package.json +++ b/npm-package/package.json @@ -11,7 +11,7 @@ "test": "jest", "dev": "nodemon src/server.ts", "build": "tsc", - "semantic-release": "semantic-release --branches main", + "semantic-release": "semantic-release", "commit": "git-cz" }, "repository": { From f6e7f4fd375b96b5536bdba39315fd4c26122fa2 Mon Sep 17 00:00:00 2001 From: Yourui Date: Sat, 15 Jul 2023 13:29:52 -0400 Subject: [PATCH 2/2] added back merge check --- .github/workflows/npmCD.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npmCD.yml b/.github/workflows/npmCD.yml index 89dc0c9..9f70563 100644 --- a/.github/workflows/npmCD.yml +++ b/.github/workflows/npmCD.yml @@ -12,6 +12,14 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + - name: Check if PR is merged + id: check_merge + run: | + if [[ "$(git log -1 --pretty=%B "${{ github.event.pull_request.merge_commit_sha }}")" == *"Merge pull request"* ]]; then + echo "is_merged=true" >> $GITHUB_ENV + else + echo "is_merged=false" >> $GITHUB_ENV + fi - name: Setup node env uses: actions/setup-node@v3 with: @@ -26,4 +34,5 @@ jobs: env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npm run semantic-release - working-directory: ./npm-package \ No newline at end of file + working-directory: ./npm-package + if: steps.check_merge.outputs.is_merged == 'true' \ No newline at end of file