From d147955dc3c425808a680e0bbf5a0b22ae496d87 Mon Sep 17 00:00:00 2001 From: guozichun Date: Mon, 29 Apr 2024 00:50:08 +0800 Subject: [PATCH 1/3] ci(new feature): :ferris_wheel: update relase & develop CI create pull request flow --- .github/workflows/CI.yml | 3 +++ .github/workflows/Release.yml | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f803c6a..b0bae0b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -5,6 +5,8 @@ on: - develop - release/** - hotfix/** + - support/** + - feature/** defaults: run: shell: bash @@ -58,6 +60,7 @@ jobs: run: pnpm run build - name: 🦋 Create Pull Request + if: startsWith(github.ref_name, 'feature/') uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 3137d62..83a87c1 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -57,13 +57,8 @@ jobs: id: build-the-library run: | pnpm build - - name: test echo - run: | - echo ${{github.head_ref}} - echo ${{github.event_name}} - echo ${{github.ref_name}} - name: 📣 Create Release Pull Request or Publish to npm - if: github.head_ref == 'changeset-release/main' && github.event_name == 'push' + if: startsWith(github.head_ref, 'release/') && github.event_name == 'pull_request' id: changesets uses: changesets/action@v1.4.7 with: From 3acbd2861456a4bf9c54c3c0bcae04765042678a Mon Sep 17 00:00:00 2001 From: guozichun Date: Mon, 29 Apr 2024 00:57:35 +0800 Subject: [PATCH 2/3] refactor(new feature): :recycle: update ci --- .github/workflows/CI.yml | 9 +++++---- .github/workflows/Release.yml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b0bae0b..1820abf 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -57,17 +57,18 @@ jobs: run: pnpm run test - name: 📦 Build + if: startsWith(github.ref_name, 'release/') || startsWith(github.ref_name, 'hotfix/') || startsWith(github.ref_name, 'support/') run: pnpm run build - name: 🦋 Create Pull Request - if: startsWith(github.ref_name, 'feature/') + if: startsWith(github.ref_name, 'release/') || startsWith(github.ref_name, 'hotfix/') || startsWith(github.ref_name, 'support/') uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ github.ref }} base: main - title: "Pull Request form Github Actions" - body: "This is a pull request created by Actions Robot 🤖" - commit-message: "Pull Request ${{ github.head_ref }} into main" + title: "🤖 Pull Request form ${{github.ref_name}}" + body: "created by Actions Robot 🤖" + commit-message: "Pull Request ${{ github.ref_name }} into main" labels: "CI" assignees: "guotingchao" diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 83a87c1..410c08d 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -57,7 +57,7 @@ jobs: id: build-the-library run: | pnpm build - - name: 📣 Create Release Pull Request or Publish to npm + - name: 📣 Create Release Pull Request and Publish to Npm if: startsWith(github.head_ref, 'release/') && github.event_name == 'pull_request' id: changesets uses: changesets/action@v1.4.7 From 7b4503823d42398e3d7891d932d95a4e975c2494 Mon Sep 17 00:00:00 2001 From: guozichun Date: Mon, 29 Apr 2024 01:13:40 +0800 Subject: [PATCH 3/3] ci(CI&CD): :ferris_wheel: new version --- .github/workflows/Release.yml | 8 +++++++- package.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 410c08d..1e99564 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -57,7 +57,7 @@ jobs: id: build-the-library run: | pnpm build - - name: 📣 Create Release Pull Request and Publish to Npm + - name: 📣 Create Release Pull Request and Publish new version to Npm if: startsWith(github.head_ref, 'release/') && github.event_name == 'pull_request' id: changesets uses: changesets/action@v1.4.7 @@ -69,3 +69,9 @@ jobs: env: GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} NPM_TOKEN: ${{ env.NPM_TOKEN }} + - name: 🎺 Publish new version to Github Packages + if: startsWith(github.head_ref, 'changeset-release/main') && github.event_name == 'pull_request' + uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + registry: "https://npm.pkg.github.com" diff --git a/package.json b/package.json index c138331..406e624 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "access": "public", "scope": "@cardbrother", "tag": "latest", - "registry": "https://registry.npmjs.org/" + "registry": "https://registry.npmjs.org" }, "bugs": { "url": "https://github.com/guotingchao/nest-tencent-cloud-sdk/issues",