From ecbaf5435a100af897e9a627fe7be62c58fcac23 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Fri, 12 Jun 2026 23:14:41 +0530 Subject: [PATCH 01/24] feat(release): sementic release --- .github/PULL_REQUEST_TEMPLATE.md | 22 ++++ .../{cd-production.yml => create-release.yml} | 3 +- .../{cd-staging.yml => deploy-staging.yml} | 0 .github/workflows/pre-release.yml | 107 ++++++++++++++++++ .releaserc.json | 24 ++++ 5 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md rename .github/workflows/{cd-production.yml => create-release.yml} (93%) rename .github/workflows/{cd-staging.yml => deploy-staging.yml} (100%) create mode 100644 .github/workflows/pre-release.yml create mode 100644 .releaserc.json diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..35748f7c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,22 @@ +## Issue: PLEASE_TYPE_ISSUE_NUMBER + +## Type + +type: <-- Add the type of the PR --> + + + +## Summary + +Explain the **motivation** for making this change. What existing problem does the pull request solve? + +## Checklist + +Before submitting a pull request, please ensure that you mark these task. + +- [ ] Ran `npm run dev` in the repository root and test. +- [ ] If you've fixed a bug or added code that is tested + +## Notes + +Please add here if any other information is required for the reviewer. diff --git a/.github/workflows/cd-production.yml b/.github/workflows/create-release.yml similarity index 93% rename from .github/workflows/cd-production.yml rename to .github/workflows/create-release.yml index 2958a790..2628be26 100644 --- a/.github/workflows/cd-production.yml +++ b/.github/workflows/create-release.yml @@ -3,11 +3,12 @@ name: Deploy Kaapi to EC2 Production on: push: tags: - - "v*" # Deploy only when tags like v1.0.0, v2.1.0, etc., are created + - "v[0-9]+.[0-9]+.[0-9]+" # Deploy only when tags like v1.0.0, v2.1.0, etc., are created jobs: deploy: runs-on: ubuntu-latest + if: ${{ !contains(github.ref_name, '-') }} environment: AWS_ENV permissions: diff --git a/.github/workflows/cd-staging.yml b/.github/workflows/deploy-staging.yml similarity index 100% rename from .github/workflows/cd-staging.yml rename to .github/workflows/deploy-staging.yml diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 00000000..929c5345 --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,107 @@ +name: Pre-release Tag + +on: + pull_request: + types: [closed] + branches: [main] + +jobs: + pre-release: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get PR type from description + id: pr-type + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const body = context.payload.pull_request.body || ''; + const typeMatch = body.match(/type:\s*(feat|fix|chore|docs|refactor)/i); + + if (!typeMatch) { + core.setOutput('type', 'fix'); + return; + } + + const type = typeMatch[1].toLowerCase(); + core.setOutput('type', type); + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install semantic-release + run: | + npm install -g \ + semantic-release \ + @semantic-release/commit-analyzer \ + @semantic-release/release-notes-generator \ + @semantic-release/github + + - name: Create conventional commit + env: + COMMIT_TYPE: ${{ steps.pr-type.outputs.type }} + run: | + git config user.email "ci@github.com" + git config user.name "GitHub CI" + ORIGINAL_MSG=$(git log -1 --pretty=%s) + git commit --allow-empty -m "${COMMIT_TYPE}: ${ORIGINAL_MSG}" + + - name: Run semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx semantic-release + + - name: Update PR labels + if: success() + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const prNumber = context.payload.pull_request.number; + + const labelsToCreate = [ + { name: 'released', color: '0075ca' }, + { name: 'released on @main', color: '0052cc' } + ]; + + for (const label of labelsToCreate) { + try { + await github.rest.issues.getLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: label.name + }); + } catch { + await github.rest.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: label.name, + color: label.color + }); + } + } + + await github.rest.issues.removeAllLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber + }); + + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + labels: ['released', 'released on @main'] + }); \ No newline at end of file diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 00000000..c3d84402 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,24 @@ +{ + "branches": [ + { + "name": "main", + "prerelease": "main" + } + ], + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "releaseRules": [ + { "type": "feat", "release": "minor" }, + { "type": "fix", "release": "patch" }, + { "type": "chore", "release": "patch" }, + { "type": "docs", "release": "patch" }, + { "type": "refactor", "release": "patch" } + ] + } + ], + "@semantic-release/release-notes-generator", + "@semantic-release/github" + ] +} From 88d00247d20b3363063e9d0fcd88ae58624d1ea1 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sat, 13 Jun 2026 22:42:37 +0530 Subject: [PATCH 02/24] fix(template): update the pull request template --- .github/PULL_REQUEST_TEMPLATE.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 35748f7c..d48a5fd8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,6 @@ -## Issue: PLEASE_TYPE_ISSUE_NUMBER +## Issue + +Closes #PLEASE_TYPE_ISSUE_NUMBER ## Type From 25eecd7ed32c00b5a474dc047d9cbc62e1adbccb Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sat, 13 Jun 2026 22:44:56 +0530 Subject: [PATCH 03/24] fix(template): update the pull request template --- .github/workflows/pre-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 929c5345..246c73d5 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -104,4 +104,4 @@ jobs: repo: context.repo.repo, issue_number: prNumber, labels: ['released', 'released on @main'] - }); \ No newline at end of file + }); From 6fd2c7586b058717d2532e75ae3a9b4864e1f745 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:13:24 +0530 Subject: [PATCH 04/24] fix(*): testing --- .github/workflows/pre-release.yml | 2 +- .releaserc.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 246c73d5..a4a2699a 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -3,7 +3,7 @@ name: Pre-release Tag on: pull_request: types: [closed] - branches: [main] + branches: [feat/semantic-release] jobs: pre-release: diff --git a/.releaserc.json b/.releaserc.json index c3d84402..09fd5ec4 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,8 +1,8 @@ { "branches": [ { - "name": "main", - "prerelease": "main" + "name": "feat/semantic-release", + "prerelease": "feat/semantic-release" } ], "plugins": [ From 9490e20fe66e3ea850635006d25c793a372f884b Mon Sep 17 00:00:00 2001 From: Ayush <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:17:39 +0530 Subject: [PATCH 05/24] Release: Semantic Release Testing (#208) --- app/lib/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/constants.ts b/app/lib/constants.ts index 4b4f392c..b9d1e825 100644 --- a/app/lib/constants.ts +++ b/app/lib/constants.ts @@ -10,7 +10,7 @@ import { AnalyticsModality, } from "@/app/lib/types/analytics"; -export const APP_NAME = "Kaapi Konsole"; +export const APP_NAME = "Kaapi Konsole Staging"; export const STORAGE_KEYS = { API_KEYS: "kaapi_api_keys", From b646680c624a0470ec4e7154e62ea03650b17acb Mon Sep 17 00:00:00 2001 From: Ayush <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:21:36 +0530 Subject: [PATCH 06/24] Release: Pre-Release Testing (#210) --- app/lib/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/constants.ts b/app/lib/constants.ts index b9d1e825..4b4f392c 100644 --- a/app/lib/constants.ts +++ b/app/lib/constants.ts @@ -10,7 +10,7 @@ import { AnalyticsModality, } from "@/app/lib/types/analytics"; -export const APP_NAME = "Kaapi Konsole Staging"; +export const APP_NAME = "Kaapi Konsole"; export const STORAGE_KEYS = { API_KEYS: "kaapi_api_keys", From ee842ad3aa0ebd027d8f8518a4e9a296f0409405 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:29:13 +0530 Subject: [PATCH 07/24] fix(*): few updates for testing --- .github/workflows/pre-release.yml | 7 ++++--- .releaserc.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index a4a2699a..9d35874d 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -1,9 +1,10 @@ name: Pre-release Tag on: - pull_request: - types: [closed] - branches: [feat/semantic-release] + # pull_request: + push: + # types: [closed] + branches: [main] jobs: pre-release: diff --git a/.releaserc.json b/.releaserc.json index 09fd5ec4..f35c7e2c 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -2,7 +2,7 @@ "branches": [ { "name": "feat/semantic-release", - "prerelease": "feat/semantic-release" + "prerelease": "beta" } ], "plugins": [ From 5462ccb9dea80ac912d74db8f71a4c93a08aa1f1 Mon Sep 17 00:00:00 2001 From: Ayush <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:31:12 +0530 Subject: [PATCH 08/24] Release: Pre-Release Testing (#211) --- app/lib/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/constants.ts b/app/lib/constants.ts index 4b4f392c..b9d1e825 100644 --- a/app/lib/constants.ts +++ b/app/lib/constants.ts @@ -10,7 +10,7 @@ import { AnalyticsModality, } from "@/app/lib/types/analytics"; -export const APP_NAME = "Kaapi Konsole"; +export const APP_NAME = "Kaapi Konsole Staging"; export const STORAGE_KEYS = { API_KEYS: "kaapi_api_keys", From f5dfe2933285db63339341498ecdfd32ac20841d Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:33:44 +0530 Subject: [PATCH 09/24] fix(*): update the branch name --- .github/workflows/pre-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 9d35874d..0f52f6ce 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -4,7 +4,7 @@ on: # pull_request: push: # types: [closed] - branches: [main] + branches: [feat/semantic-release] jobs: pre-release: From 3972c6b0c741e8c4b30f21a9d5eace342d5e0cfe Mon Sep 17 00:00:00 2001 From: Ayush <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:36:23 +0530 Subject: [PATCH 10/24] Release: Pre-Release Testing (#212) --- app/lib/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/constants.ts b/app/lib/constants.ts index b9d1e825..4871a8db 100644 --- a/app/lib/constants.ts +++ b/app/lib/constants.ts @@ -10,7 +10,7 @@ import { AnalyticsModality, } from "@/app/lib/types/analytics"; -export const APP_NAME = "Kaapi Konsole Staging"; +export const APP_NAME = "Kaapi Konsole Staging V1"; export const STORAGE_KEYS = { API_KEYS: "kaapi_api_keys", From 4d1816822ac34469d08ad67c796a64e19b1325b0 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:54:21 +0530 Subject: [PATCH 11/24] feat: test semantic release From 65022571c202b39978445478ff0cdf5e69fb33a1 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:55:06 +0530 Subject: [PATCH 12/24] fix(*): added branch name for testing --- .github/workflows/pre-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 0f52f6ce..ed1dada6 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -1,15 +1,14 @@ name: Pre-release Tag on: - # pull_request: push: - # types: [closed] branches: [feat/semantic-release] jobs: pre-release: if: github.event.pull_request.merged == true runs-on: ubuntu-latest + name: Pre-Release permissions: contents: write issues: write From b46d077bb21cb6b4b150e76f00a8e886d3faf3f0 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:55:12 +0530 Subject: [PATCH 13/24] feat: test semantic release From 393c37258987f2ffcbaf0918e84e0c1fbbf834f2 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:57:06 +0530 Subject: [PATCH 14/24] fix(*): added branch name for testing --- .github/workflows/pre-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index ed1dada6..59af1d35 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -6,7 +6,6 @@ on: jobs: pre-release: - if: github.event.pull_request.merged == true runs-on: ubuntu-latest name: Pre-Release permissions: From 0523eeb11b3faff812faa48f75bebf8fab60ce57 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:57:12 +0530 Subject: [PATCH 15/24] feat: test semantic release From d572b08c56595a44ac18ff581ecf260f53c5bf92 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 13:58:09 +0530 Subject: [PATCH 16/24] feat: test semantic release From 4df18be3149cc4c80547de90e2ba5d4c978637ce Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 14:03:42 +0530 Subject: [PATCH 17/24] feat: semantic release test --- .github/workflows/pre-release.yml | 44 +++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 59af1d35..b17d28d8 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -18,22 +18,22 @@ jobs: with: fetch-depth: 0 - - name: Get PR type from description - id: pr-type - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const body = context.payload.pull_request.body || ''; - const typeMatch = body.match(/type:\s*(feat|fix|chore|docs|refactor)/i); + # - name: Get PR type from description + # id: pr-type + # uses: actions/github-script@v7 + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # script: | + # const body = context.payload.pull_request.body || ''; + # const typeMatch = body.match(/type:\s*(feat|fix|chore|docs|refactor)/i); - if (!typeMatch) { - core.setOutput('type', 'fix'); - return; - } + # if (!typeMatch) { + # core.setOutput('type', 'fix'); + # return; + # } - const type = typeMatch[1].toLowerCase(); - core.setOutput('type', type); + # const type = typeMatch[1].toLowerCase(); + # core.setOutput('type', type); - name: Setup Node uses: actions/setup-node@v4 @@ -48,14 +48,14 @@ jobs: @semantic-release/release-notes-generator \ @semantic-release/github - - name: Create conventional commit - env: - COMMIT_TYPE: ${{ steps.pr-type.outputs.type }} - run: | - git config user.email "ci@github.com" - git config user.name "GitHub CI" - ORIGINAL_MSG=$(git log -1 --pretty=%s) - git commit --allow-empty -m "${COMMIT_TYPE}: ${ORIGINAL_MSG}" + # - name: Create conventional commit + # env: + # COMMIT_TYPE: ${{ steps.pr-type.outputs.type }} + # run: | + # git config user.email "ci@github.com" + # git config user.name "GitHub CI" + # ORIGINAL_MSG=$(git log -1 --pretty=%s) + # git commit --allow-empty -m "${COMMIT_TYPE}: ${ORIGINAL_MSG}" - name: Run semantic-release env: From c6a64058c92f9271d9dad23d508ac9ce2ae0afc0 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 14:06:46 +0530 Subject: [PATCH 18/24] feat: semantic release test --- .releaserc.json => .releaserc | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .releaserc.json => .releaserc (100%) diff --git a/.releaserc.json b/.releaserc similarity index 100% rename from .releaserc.json rename to .releaserc From d66cda1ddc47fe829300a02afaf56191dc1dee56 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 14:07:49 +0530 Subject: [PATCH 19/24] feat: semantic release test --- .releaserc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.releaserc b/.releaserc index f35c7e2c..c3d84402 100644 --- a/.releaserc +++ b/.releaserc @@ -1,8 +1,8 @@ { "branches": [ { - "name": "feat/semantic-release", - "prerelease": "beta" + "name": "main", + "prerelease": "main" } ], "plugins": [ From 15c5f08401b25faba7f8aab476110da74d251620 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 14:13:21 +0530 Subject: [PATCH 20/24] feat: semantic release test --- .github/workflows/pre-release.yml | 2 +- .releaserc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index b17d28d8..8ad39efb 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -60,7 +60,7 @@ jobs: - name: Run semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: npx semantic-release + run: npx semantic-release --branches feat/semantic-release - name: Update PR labels if: success() diff --git a/.releaserc b/.releaserc index c3d84402..f35c7e2c 100644 --- a/.releaserc +++ b/.releaserc @@ -1,8 +1,8 @@ { "branches": [ { - "name": "main", - "prerelease": "main" + "name": "feat/semantic-release", + "prerelease": "beta" } ], "plugins": [ From f9f03a65198922c55d42f218a68a549f0ebf8e5a Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 16:22:40 +0530 Subject: [PATCH 21/24] fix(*): pre-release setup correctly --- .github/workflows/pre-release.yml | 189 ++++++++++++++++++++++++++---- .releaserc | 5 +- 2 files changed, 167 insertions(+), 27 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 8ad39efb..75e3e882 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -1,11 +1,13 @@ name: Pre-release Tag on: - push: - branches: [feat/semantic-release] + pull_request: + types: [closed] + branches: [main] jobs: pre-release: + if: github.event.pull_request.merged == true runs-on: ubuntu-latest name: Pre-Release permissions: @@ -16,24 +18,25 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: + ref: ${{ github.event.pull_request.base.ref }} fetch-depth: 0 - # - name: Get PR type from description - # id: pr-type - # uses: actions/github-script@v7 - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # script: | - # const body = context.payload.pull_request.body || ''; - # const typeMatch = body.match(/type:\s*(feat|fix|chore|docs|refactor)/i); + - name: Get PR type from description + id: pr-type + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const body = context.payload.pull_request.body || ''; + const typeMatch = body.match(/type:\s*(feat|fix|chore|docs|refactor)/i); - # if (!typeMatch) { - # core.setOutput('type', 'fix'); - # return; - # } + if (!typeMatch) { + core.setOutput('type', 'fix'); + return; + } - # const type = typeMatch[1].toLowerCase(); - # core.setOutput('type', type); + const type = typeMatch[1].toLowerCase(); + core.setOutput('type', type); - name: Setup Node uses: actions/setup-node@v4 @@ -48,19 +51,155 @@ jobs: @semantic-release/release-notes-generator \ @semantic-release/github - # - name: Create conventional commit - # env: - # COMMIT_TYPE: ${{ steps.pr-type.outputs.type }} - # run: | - # git config user.email "ci@github.com" - # git config user.name "GitHub CI" - # ORIGINAL_MSG=$(git log -1 --pretty=%s) - # git commit --allow-empty -m "${COMMIT_TYPE}: ${ORIGINAL_MSG}" + - name: Create conventional commit + env: + COMMIT_TYPE: ${{ steps.pr-type.outputs.type }} + run: | + git config user.email "ci@github.com" + git config user.name "GitHub CI" + ORIGINAL_MSG=$(git log -1 --pretty=%s) + git commit --allow-empty -m "${COMMIT_TYPE}: ${ORIGINAL_MSG}" - name: Run semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: npx semantic-release --branches feat/semantic-release + run: npx semantic-release + + - name: Rewrite notes (cumulative, grouped, since last stable) + if: success() + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { owner, repo } = context.repo; + const cmp = (a, b) => a[0] - b[0] || a[1] - b[1] || a[2] - b[2]; + + const releases = await github.paginate(github.rest.repos.listReleases, { + owner, repo, per_page: 100, + }); + const latest = releases + .filter(r => r.prerelease && /-main\.\d+$/.test(r.tag_name)) + .sort((a, b) => new Date(b.created_at) - new Date(a.created_at))[0]; + if (!latest) { + core.info('No pre-release found to update.'); + return; + } + + const tags = await github.paginate(github.rest.repos.listTags, { + owner, repo, per_page: 100, + }); + const stableRe = /^v(\d+)\.(\d+)\.(\d+)$/; + let stableTag = null; + let stableVer = [-1, -1, -1]; + for (const t of tags) { + const m = stableRe.exec(t.name); + if (m) { + const v = [+m[1], +m[2], +m[3]]; + if (cmp(v, stableVer) > 0) { stableVer = v; stableTag = t.name; } + } + } + + let sinceMs = 0; + if (stableTag) { + const ref = await github.rest.git.getRef({ owner, repo, ref: `tags/${stableTag}` }); + let sha = ref.data.object.sha; + if (ref.data.object.type === 'tag') { + const t = await github.rest.git.getTag({ owner, repo, tag_sha: sha }); + sha = t.data.object.sha; + } + const c = await github.rest.repos.getCommit({ owner, repo, ref: sha }); + sinceMs = new Date(c.data.commit.committer.date).getTime(); + } + + const merged = []; + for (let page = 1; page <= 20; page++) { + const { data } = await github.rest.pulls.list({ + owner, repo, state: 'closed', base: 'main', + sort: 'updated', direction: 'desc', per_page: 100, page, + }); + if (!data.length) break; + for (const pr of data) { + if (pr.merged_at && new Date(pr.merged_at).getTime() > sinceMs) merged.push(pr); + } + if (new Date(data[data.length - 1].updated_at).getTime() < sinceMs) break; + } + + if (!merged.length) { + core.info('No merged PRs since last stable; leaving notes as-is.'); + return; + } + + const cats = [ + { title: '๐Ÿš€ Features', types: ['feat'] }, + { title: '๐Ÿ› Fixes', types: ['fix'] }, + { title: '๐Ÿงน Chores', types: ['chore'] }, + { title: '๐Ÿ“š Documentation', types: ['docs'] }, + { title: 'โ™ป๏ธ Refactors', types: ['refactor'] }, + { title: 'Other Changes', types: ['*'] }, + ].map(c => ({ ...c, items: [] })); + + const typeOf = (pr) => { + const m = (pr.body || '').match(/type:\s*(feat|fix|chore|docs|refactor)/i); + return m ? m[1].toLowerCase() : 'fix'; + }; + const seen = new Set(); + for (const pr of merged) { + if (seen.has(pr.number)) continue; + seen.add(pr.number); + const type = typeOf(pr); + const bucket = cats.find(c => c.types.includes(type)) || cats.find(c => c.types.includes('*')); + bucket.items.push(pr); + } + + let body = `## What's Changed\n`; + for (const c of cats) { + if (!c.items.length) continue; + body += `\n### ${c.title}\n`; + for (const pr of c.items) { + body += `* ${pr.title} by @${pr.user.login} in #${pr.number}\n`; + } + } + if (stableTag) { + body += `\n**Full Changelog**: https://github.com/${owner}/${repo}/compare/${stableTag}...${latest.tag_name}\n`; + } + + await github.rest.repos.updateRelease({ + owner, repo, release_id: latest.id, body, + }); + core.info(`Rewrote ${latest.tag_name} notes: ${merged.length} PR(s) since ${stableTag || 'repo start'}.`); + + - name: Remove previous pre-releases + if: success() + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { owner, repo } = context.repo; + + const releases = await github.paginate( + github.rest.repos.listReleases, + { owner, repo, per_page: 100 } + ); + + const preReleases = releases + .filter(r => r.prerelease && /-main\.\d+$/.test(r.tag_name)) + .sort((a, b) => new Date(b.created_at) - new Date(a.created_at)); + + const stale = preReleases.slice(1); + + for (const r of stale) { + core.info(`Deleting stale pre-release ${r.tag_name}`); + await github.rest.repos.deleteRelease({ owner, repo, release_id: r.id }); + try { + await github.rest.git.deleteRef({ + owner, + repo, + ref: `tags/${r.tag_name}`, + }); + } catch (e) { + core.warning(`Could not delete tag ${r.tag_name}: ${e.message}`); + } + } - name: Update PR labels if: success() diff --git a/.releaserc b/.releaserc index f35c7e2c..ea8bbe89 100644 --- a/.releaserc +++ b/.releaserc @@ -1,8 +1,9 @@ { "branches": [ + "release", { - "name": "feat/semantic-release", - "prerelease": "beta" + "name": "main", + "prerelease": "main" } ], "plugins": [ From 91d8db2ef79fd0034c0737a7952a64a02dd663e7 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 18:02:31 +0530 Subject: [PATCH 22/24] fix(release): remove the unwanted if condition --- .github/workflows/create-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 2628be26..6d56da73 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -8,7 +8,6 @@ on: jobs: deploy: runs-on: ubuntu-latest - if: ${{ !contains(github.ref_name, '-') }} environment: AWS_ENV permissions: From f048b03410a30cb4deab21bd4dd21595a228f25f Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Sun, 14 Jun 2026 18:31:42 +0530 Subject: [PATCH 23/24] fix(*): update the pull request template --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d48a5fd8..d11de29a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -16,7 +16,7 @@ Explain the **motivation** for making this change. What existing problem does th Before submitting a pull request, please ensure that you mark these task. -- [ ] Ran `npm run dev` in the repository root and test. +- [ ] Ran `npm run dev` and `npm run build` in the repository root and test. - [ ] If you've fixed a bug or added code that is tested ## Notes From d52e0d471a1f56ba9521173c88671fe51d652f57 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Mon, 15 Jun 2026 11:59:12 +0530 Subject: [PATCH 24/24] fix(release): added the concurrency --- .github/workflows/pre-release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 75e3e882..8d0b402f 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -5,6 +5,10 @@ on: types: [closed] branches: [main] +concurrency: + group: pre-release + cancel-in-progress: false + jobs: pre-release: if: github.event.pull_request.merged == true