@devilsdev/rag-pipeline-utils 2.1.5 โ†’ 2.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,73 @@
1
+ # .github/workflows/auto-release-note.yml
2
+ # Version: 1.0.0
3
+ # Description: Unified workflow to generate changelog + blog post from Git tag
4
+ # Author: Ali Kahwaji
5
+
6
+ name: โœซ Auto Release Note
7
+
8
+ on:
9
+ push:
10
+ tags:
11
+ - 'v*'
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: write
16
+
17
+ jobs:
18
+ generate-note:
19
+ name: ๐Ÿ– Generate Blog + Changelog
20
+ runs-on: ubuntu-latest
21
+
22
+ steps:
23
+ - name: โฌ‡๏ธ Checkout code
24
+ uses: actions/checkout@v4
25
+
26
+ - name: ๐Ÿ”ง Setup Node.js
27
+ uses: actions/setup-node@v4
28
+ with:
29
+ node-version: 20
30
+
31
+ - name: ๐Ÿ“ฆ Install dependencies
32
+ run: npm ci
33
+
34
+ - name: ๐Ÿ“‘ Generate release note from tag
35
+ env:
36
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37
+ run: |
38
+ VERSION=${GITHUB_REF#refs/tags/v}
39
+ echo "Generating blog + changelog for v$VERSION"
40
+
41
+ git fetch --tags --force
42
+
43
+ node scripts/generate-release-note.js v$VERSION
44
+
45
+ - name: ๐Ÿ“„ Auto-commit blog + changelog
46
+ uses: stefanzweifel/git-auto-commit-action@v5
47
+ with:
48
+ commit_message: "docs(release): auto-publish blog and changelog"
49
+ file_pattern: "CHANGELOG.md docs-site/blog/*.md"
50
+ push_options: '--follow-tags'
51
+
52
+ - name: ๐Ÿš€ Confirm complete
53
+ run: echo "Release blog + changelog committed and pushed."
54
+
55
+ - name: ๐Ÿ“ˆ Emit Blog Badge Trigger
56
+ run: echo "::set-output name=blog::generated"
57
+
58
+ - name: ๐ŸŒŸ Trigger Badge (Optional)
59
+ if: always()
60
+ uses: peter-evans/create-or-update-comment@v4
61
+ with:
62
+ issue-number: 1
63
+ body: "Blog Post + Changelog updated for ${{ github.ref_name }} :rocket:"
64
+ env:
65
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66
+
67
+ - name: ๐Ÿ’ฌ Comment on PR (optional)
68
+ if: github.event.pull_request.number != ''
69
+ uses: peter-evans/create-or-update-comment@v4
70
+ with:
71
+ issue-number: ${{ github.event.pull_request.number }}
72
+ body: "๐Ÿ“ข Blog + Changelog updated for ${{ github.ref_name }} ๐ŸŽ‰"
73
+
@@ -1,5 +1,5 @@
1
1
  # .github/workflows/ci.yml
2
- # Version: 1.0.0
2
+ # Version: 1.1.0
3
3
  # Description: Clean CI pipeline with lint, test, fixtures, coverage, and release
4
4
  # Author: Ali Kahwaji
5
5
 
@@ -8,6 +8,7 @@ name: CI & Release
8
8
  on:
9
9
  push:
10
10
  branches: [main]
11
+ tags: ['v*']
11
12
  pull_request:
12
13
  branches: [main]
13
14
 
@@ -30,7 +31,7 @@ jobs:
30
31
  - name: ๐Ÿ“ฆ Install dependencies
31
32
  run: npm ci
32
33
 
33
- - name: ๐Ÿงน Lint
34
+ - name: ๐Ÿงน Lint codebase
34
35
  run: npm run lint
35
36
 
36
37
  - name: โœ… Run tests with coverage
@@ -47,7 +48,8 @@ jobs:
47
48
 
48
49
  - name: ๐Ÿš€ Semantic Release
49
50
  env:
50
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
51
+ GH_TOKEN: ${{ secrets.GH_TOKEN }} # โœ… Required by @semantic-release/github
52
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} # โœ… Used by GitHub Actions
51
53
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52
54
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
53
55
  run: npx semantic-release
@@ -1,9 +1,9 @@
1
1
  # .github/workflows/docs-ci.yml
2
- # Version: 1.1.0
3
- # Description: CI pipeline for linting, testing, and building docs
2
+ # Version: 1.2.0
3
+ # Description: CI pipeline for linting, testing, and building docs with improved caching and consistency
4
4
  # Author: Ali Kahwaji
5
5
 
6
- name: Docs CI
6
+ name: ๐Ÿ“˜ Docs CI
7
7
 
8
8
  on:
9
9
  push:
@@ -12,19 +12,19 @@ on:
12
12
  branches: [main]
13
13
 
14
14
  jobs:
15
- build:
15
+ docs-ci:
16
16
  runs-on: ubuntu-latest
17
17
 
18
18
  steps:
19
- - name: โฌ‡๏ธ Checkout repository
19
+ - name: โฌ‡๏ธ Checkout code
20
20
  uses: actions/checkout@v4
21
21
 
22
22
  - name: ๐ŸŸข Setup Node.js
23
23
  uses: actions/setup-node@v4
24
24
  with:
25
- node-version: '18'
25
+ node-version: 20
26
26
  cache: 'npm'
27
- cache-dependency-path: 'package-lock.json'
27
+ cache-dependency-path: '**/package-lock.json'
28
28
 
29
29
  - name: ๐Ÿ“ฆ Install dependencies
30
30
  run: npm ci
@@ -35,11 +35,11 @@ jobs:
35
35
  - name: ๐Ÿ›  Build documentation
36
36
  run: npm run docs:build
37
37
 
38
- - name: โœ… Run tests (optional)
38
+ - name: โœ… Run tests
39
39
  run: npm test
40
40
  if: ${{ always() }}
41
41
 
42
- - name: ๐Ÿ“ฆ Upload docs build (optional)
42
+ - name: ๐Ÿ“ฆ Upload built docs (optional)
43
43
  uses: actions/upload-artifact@v4
44
44
  with:
45
45
  name: docusaurus-build
@@ -1,6 +1,6 @@
1
1
  # .github/workflows/docs-deploy.yml
2
- # Version: 1.1.0
3
- # Description: Deploys Docusaurus docs site to GitHub Pages
2
+ # Version: 1.2.0
3
+ # Description: Deploys Docusaurus docs site to GitHub Pages with CNAME and post-release chaining
4
4
  # Author: Ali Kahwaji
5
5
 
6
6
  name: ๐Ÿ“š Deploy Docusaurus Docs
@@ -17,39 +17,48 @@ on:
17
17
  - 'package.json'
18
18
 
19
19
  permissions:
20
- contents: write # Required for GitHub Pages deployment
20
+ contents: write
21
21
 
22
22
  jobs:
23
23
  deploy:
24
- name: Deploy to GitHub Pages
24
+ name: ๐Ÿš€ Publish to GitHub Pages
25
25
  runs-on: ubuntu-latest
26
26
 
27
27
  steps:
28
- - name: Checkout repository
28
+ - name: ๐Ÿ“ฅ Checkout repository
29
29
  uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 0 # โœ… Full git history for tag diff or changelog sync
30
32
 
31
- - name: Setup Node.js
33
+ - name: ๐Ÿงฐ Setup Node.js
32
34
  uses: actions/setup-node@v4
33
35
  with:
34
- node-version: '18'
36
+ node-version: 20
35
37
  cache: 'npm'
36
38
 
37
- - name: Install dependencies
39
+ - name: ๐Ÿ“ฆ Install dependencies
38
40
  run: npm ci
39
41
 
40
- - name: Build docs
42
+ - name: ๐Ÿ›  Git Identity
43
+ run: |
44
+ git config --global user.name "GitHub Actions"
45
+ git config --global user.email "github-actions@github.com"
46
+
47
+ - name: ๐Ÿ›  Build docs
41
48
  run: npm run docs:build
42
49
 
43
- - name: Configure Git user
50
+ - name: โœ… Auto-generate release blog + changelog (if not triggered by tag)
44
51
  run: |
45
- git config --global user.name "GitHub Actions"
46
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
52
+ TAG=$(git describe --tags --abbrev=0)
53
+ node scripts/generate-release-note.js "$TAG" || echo "๐Ÿ” Skipped blog generation fallback"
54
+ if: success() && !startsWith(github.ref, 'refs/tags/')
47
55
 
48
- - name: Deploy to GitHub Pages
56
+ - name: ๐Ÿš€ Deploy to GitHub Pages
49
57
  uses: peaceiris/actions-gh-pages@v4
50
58
  with:
51
59
  github_token: ${{ secrets.GITHUB_TOKEN }}
52
60
  publish_dir: docs-site/build
53
61
  publish_branch: gh-pages
62
+ cname: docs.rag-utils.dev # ๐Ÿ”ง CHANGE THIS if you use a custom domain
54
63
  user_name: github-actions[bot]
55
- user_email: github-actions[bot]@users.noreply.github.com
64
+ user_email: 41898282+github-actions[bot]@users.noreply.github.com
@@ -1,33 +1,36 @@
1
1
  # .github/workflows/enforce-release-review.yml
2
- # Version: 1.0.1
3
- # Description: Prevents merge if changelog/blog updates not reviewed. Supports badge + manual trigger.
2
+ # Version: 1.1.0
3
+ # Description: Validates CHANGELOG.md and blog edits on PRs and tag pushes. Emits status badge.
4
4
  # Author: Ali Kahwaji
5
5
 
6
- name: ๐Ÿ›ก Release Review Enforcement
6
+ name: ๐Ÿ›ก Release Review Passed
7
7
 
8
8
  on:
9
9
  pull_request:
10
10
  branches: [main]
11
- workflow_dispatch: # โœ… Manual trigger from Actions tab
11
+ push:
12
+ tags:
13
+ - 'v*.*.*'
14
+ workflow_dispatch:
12
15
 
13
16
  permissions:
14
17
  contents: read
15
18
  pull-requests: write
16
19
 
17
20
  jobs:
18
- review-check:
19
- name: Validate Changelog & Blog Updates
21
+ review:
22
+ name: ๐Ÿ“ Release Review Check
20
23
  runs-on: ubuntu-latest
21
24
 
22
25
  steps:
23
26
  - name: ๐Ÿ“ฅ Checkout repo
24
27
  uses: actions/checkout@v4
25
28
 
26
- - name: ๐Ÿ” Scan for changelog/blog edits
29
+ - name: ๐Ÿ” Scan for changelog or blog edits
27
30
  id: check
28
31
  run: |
29
32
  git fetch origin main --depth=1
30
- CHANGED_FILES=$(git diff --name-only origin/main...HEAD)
33
+ CHANGED_FILES=$(git diff --name-only origin/main...HEAD || true)
31
34
 
32
35
  echo "Changed files:"
33
36
  echo "$CHANGED_FILES"
@@ -40,7 +43,7 @@ jobs:
40
43
  echo "result=fail" >> "$GITHUB_OUTPUT"
41
44
  fi
42
45
 
43
- - name: ๐Ÿšซ Fail if missing changelog or blog updates
46
+ - name: ๐Ÿšซ Fail if missing changelog or blog
44
47
  if: steps.check.outputs.result == 'fail'
45
48
  run: |
46
49
  echo "Missing required changelog or blog post for release."
@@ -0,0 +1,44 @@
1
+ # .github/workflows/generate-blog-post.yml
2
+ # Version: 1.1.0
3
+ # Description: Auto-generates blog posts from release tags using generate-release-note.js
4
+ # Author: Ali Kahwaji
5
+
6
+ name: "๐Ÿ“ Auto Generate Blog Post"
7
+
8
+ on:
9
+ release:
10
+ types: [published]
11
+ push:
12
+ tags:
13
+ - 'v*.*.*'
14
+
15
+ permissions:
16
+ contents: write
17
+
18
+ jobs:
19
+ blog:
20
+ name: Generate Release Blog
21
+ runs-on: ubuntu-latest
22
+
23
+ steps:
24
+ - name: โฌ‡๏ธ Checkout code
25
+ uses: actions/checkout@v4
26
+
27
+ - name: ๐Ÿ›  Setup Node
28
+ uses: actions/setup-node@v4
29
+ with:
30
+ node-version: 20
31
+
32
+ - name: ๐Ÿ“ฆ Install dependencies
33
+ run: npm ci
34
+
35
+ - name: ๐Ÿ“ Generate blog post from tag
36
+ run: node scripts/generate-release-note.js ${{ github.ref_name }} <previous-tag>
37
+ env:
38
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39
+
40
+ - name: ๐Ÿ“‹ Commit blog post
41
+ uses: stefanzweifel/git-auto-commit-action@v5
42
+ with:
43
+ commit_message: "docs(blog): auto-generate post for release ${{ github.ref_name }}"
44
+ file_pattern: "docs-site/blog/*.md"
@@ -0,0 +1,71 @@
1
+ # .github/workflows/post-release-generate-blog.yml
2
+ # Version: 2.5.2
3
+ # Description: Auto-generates changelog + blog post from tag or GitHub release with dry-run safety and badge output
4
+ # Author: Ali Kahwaji
5
+
6
+ name: Auto Generate Blog + Changelog
7
+
8
+ on:
9
+ release:
10
+ types: [published]
11
+ push:
12
+ tags:
13
+ - 'v*.*.*'
14
+ workflow_dispatch:
15
+ inputs:
16
+ dry_run:
17
+ description: 'Run generator in dry-run mode (no git push)'
18
+ required: false
19
+ default: 'false'
20
+
21
+ permissions:
22
+ contents: write
23
+ issues: write
24
+ pull-requests: write
25
+
26
+ jobs:
27
+ generate:
28
+ name: ๐Ÿ““ Generate Blog + Changelog
29
+ runs-on: ubuntu-latest
30
+ outputs:
31
+ blog_generated: ${{ steps.done.outputs.blog_generated }}
32
+
33
+ steps:
34
+ - name: ๐Ÿ“ฅ Checkout code
35
+ uses: actions/checkout@v4
36
+ with:
37
+ fetch-depth: 0
38
+
39
+ - name: ๐Ÿ›  Setup Git identity
40
+ run: |
41
+ git config --global user.name "GitHub Actions"
42
+ git config --global user.email "docs@autobot.local"
43
+
44
+ - name: ๐Ÿ“ฆ Install dependencies
45
+ run: npm ci
46
+
47
+ - name: ๐Ÿท Extract version and dry_run mode
48
+ id: context
49
+ run: |
50
+ TAG=${GITHUB_REF#refs/tags/}
51
+ echo "tag=${TAG}" >> $GITHUB_OUTPUT
52
+ echo "dry_run=${{ github.event.inputs.dry_run == 'true' && 'true' || 'false' }}" >> $GITHUB_OUTPUT
53
+
54
+ - name: ๐Ÿ“ Generate release note
55
+ id: note
56
+ run: |
57
+ echo "๐Ÿšง Running release note generator..."
58
+ node scripts/generate-release-note.js "${{ steps.context.outputs.tag }}"
59
+ env:
60
+ DRY_RUN: ${{ steps.context.outputs.dry_run }}
61
+
62
+ - name: ๐Ÿ” Commit blog & changelog
63
+ if: ${{ steps.context.outputs.dry_run != 'true' }}
64
+ uses: stefanzweifel/git-auto-commit-action@v5
65
+ with:
66
+ commit_message: "docs(release): blog + changelog for ${{ steps.context.outputs.tag }}"
67
+ file_pattern: "CHANGELOG.md docs-site/blog/*.md"
68
+
69
+ - name: โœ… Output badge result
70
+ id: done
71
+ run: echo "blog_generated=true" >> "$GITHUB_OUTPUT"
@@ -0,0 +1,50 @@
1
+ # .github/workflows/verify-blog-badge.yml
2
+ # Version: 1.3.0
3
+ # Description: Validates presence of blog generation badge + GitHub Action output
4
+ # Author: Ali Kahwaji
5
+
6
+ name: ๐Ÿ– Blog Badge Verification
7
+
8
+ on:
9
+ workflow_dispatch:
10
+ workflow_run:
11
+ workflows: ["Auto Generate Blog + Changelog"]
12
+ types:
13
+ - completed
14
+
15
+ jobs:
16
+ verify:
17
+ name: ๐ŸŒŸ Verify Blog Badge and Output
18
+ runs-on: ubuntu-latest
19
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
20
+
21
+ steps:
22
+ - name: โฌ‡๏ธ Checkout repository
23
+ uses: actions/checkout@v4
24
+
25
+ - name: ๐Ÿ” Validate README badge reference
26
+ run: |
27
+ echo "Checking for badge reference in README.md..."
28
+ grep -q "post-release-generate-blog.yml/badge.svg" README.md || {
29
+ echo "โŒ Missing badge for post-release-generate-blog.yml in README.md"
30
+ exit 1
31
+ }
32
+
33
+ - name: ๐ŸŒ Validate badge URL status
34
+ run: |
35
+ BADGE_URL="https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/post-release-generate-blog.yml/badge.svg?branch=main"
36
+ STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$BADGE_URL")
37
+
38
+ echo "Badge response: $STATUS"
39
+ if [ "$STATUS" != "200" ]; then
40
+ echo "โŒ Blog badge not reachable (HTTP $STATUS)"
41
+ exit 1
42
+ fi
43
+
44
+ - name: ๐Ÿงพ Log assumed blog generation output (manual mapping)
45
+ run: |
46
+ echo "โš ๏ธ Outputs from 'workflow_run' do not include job outputs."
47
+ echo "Assuming blog_generated=true based on successful workflow completion."
48
+
49
+ - name: โœ… Blog badge verified
50
+ run: echo "โœ… Blog badge verified and present in README."
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.7](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.6...v2.1.7) (2025-04-25)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **ci:** patch blog release workflow with DRY_RUN and safer outputs ([18f1b7d](https://github.com/DevilsDev/rag-pipeline-utils/commit/18f1b7dd4019022d76de9097db1ff8cfd858d83e))
9
+
10
+ <<<<<<< HEAD
11
+ ## 2.1.5 - 2025-04-22
12
+ ### Features
13
+ - Synced roadmap labels + issues via CI
14
+ - Added auto-close for Done roadmap entries
15
+
16
+ ### Fixes
17
+ - ES module compatibility fixes for roadmap scripts
18
+ - Improved test isolation and mocking for Octokit
19
+
20
+ ### DevOps
21
+ - CI chain includes roadmap validation and label sync
22
+ - CLI tools support changelog generation + blog linking
23
+
24
+
25
+ =======
3
26
  ## [2.1.5](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.4...v2.1.5) (2025-04-22)
4
27
 
5
28
 
@@ -7,6 +30,7 @@
7
30
 
8
31
  * **scripts:** prevent null status crash in roadmap issue closer ([89d5a0b](https://github.com/DevilsDev/rag-pipeline-utils/commit/89d5a0bc4cac554975974558b97974297816f169))
9
32
 
33
+ >>>>>>> 6475a97d362f7cd9779e1268f1c816764a7fd62c
10
34
  ## [2.1.4](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.3...v2.1.4) (2025-04-21)
11
35
 
12
36
 
@@ -95,3 +119,13 @@
95
119
  All notable changes to this project will be documented in this file.
96
120
 
97
121
  The format is based on [Semantic Versioning](https://semver.org/), and this project uses [semantic-release](https://github.com/semantic-release/semantic-release) for automated versioning and changelog generation.
122
+
123
+ ## v2.1.6
124
+
125
+ - chore: remove legacy changelog workflow and finalize blog badge
126
+ - ci(workflows): add blog badge verification workflow
127
+ - ci(workflows): add blog badge verification workflow
128
+ - ci(workflows): add blog badge verification workflow
129
+ - docs(blog): add release post for v2.1.5
130
+
131
+ ---
package/README.md CHANGED
@@ -11,6 +11,13 @@
11
11
  ![Release](https://img.shields.io/github/v/release/DevilsDev/rag-pipeline-utils?label=release)
12
12
  ![License](https://img.shields.io/github/license/devilsdev/rag-pipeline-utils)
13
13
  ![Release Review Passed](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/enforce-release-review.yml/badge.svg?branch=main)
14
+ [![Docs Deploy](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-deploy.yml/badge.svg)](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-deploy.yml)
15
+ [![Docs CI](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-ci.yml/badge.svg)](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-ci.yml)
16
+ [![Blog Generated](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/post-release-generate-blog.yml/badge.svg?branch=main)](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/post-release-generate-blog.yml)
17
+
18
+
19
+
20
+
14
21
 
15
22
 
16
23
 
@@ -0,0 +1,13 @@
1
+ ---
2
+ slug: release-v2.1.5
3
+ title: โœจ Version v2.1.5 Released
4
+ authors: [ali]
5
+ tags: [release, changelog]
6
+ ---
7
+
8
+ RAG Pipeline Utils vv2.1.5 is now available on NPM!
9
+
10
+ #### Highlights
11
+ - ๐Ÿš€ Auto-published blog from GitHub Release
12
+ - ๐Ÿ“ฆ Version bump: v2.1.5
13
+ - ๐Ÿ“˜ See CHANGELOG.md for full details
@@ -0,0 +1,21 @@
1
+ ---
2
+ slug: release-v2.1.6
3
+ title: "๐Ÿš€ Version v2.1.6 Released"
4
+ authors: [ali]
5
+ tags: [release, changelog]
6
+ ---
7
+
8
+ RAG Pipeline Utils **v2.1.6** is now available on NPM!
9
+
10
+ ## ๐Ÿ”ง Changes
11
+
12
+ - chore: remove legacy changelog workflow and finalize blog badge
13
+ - ci(workflows): add blog badge verification workflow
14
+ - ci(workflows): add blog badge verification workflow
15
+ - ci(workflows): add blog badge verification workflow
16
+ - docs(blog): add release post for v2.1.5
17
+
18
+ ## ๐Ÿ”— Resources
19
+
20
+ - GitHub Compare: [v2.1.5...v2.1.6](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.5...v2.1.6)
21
+ - View full [CHANGELOG.md](../../CHANGELOG.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devilsdev/rag-pipeline-utils",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "A modular toolkit for building RAG (Retrieval-Augmented Generation) pipelines in Node.js",
5
5
  "main": "src/core/create-pipeline.js",
6
6
  "bin": {
@@ -28,9 +28,9 @@
28
28
  "docs:build": "docusaurus build docs-site",
29
29
  "docs:serve": "docusaurus serve docs-site",
30
30
  "docs:deploy": "docusaurus deploy docs-site",
31
- "release:tag": "node scripts/tag-release.js",
32
31
  "roadmap:close": "node scripts/close-done-roadmap-issues.js",
33
- "labels:sync": "node scripts/ensure-roadmap-labels.js"
32
+ "labels:sync": "node scripts/ensure-roadmap-labels.js",
33
+ "release:tag": "node scripts/generate-release-note.js v$(node -p \"require('./package.json').version\")"
34
34
  },
35
35
  "lint-staged": {
36
36
  "**/*.{js,ts}": [
@@ -1,40 +1,110 @@
1
- // File: scripts/generate-release-note.js
1
+ // scripts/generate-release-note.js
2
2
  /**
3
- * Version: 1.2.0
4
- * Description: Injects release metadata into markdown template
3
+ * Version: 2.3.0
4
+ * Description: Generate release blog + changelog section, auto-push to Git, fallback to safe defaults
5
5
  * Author: Ali Kahwaji
6
6
  */
7
7
 
8
- const fs = require('fs');
9
- const path = require('path');
10
- const { execSync } = require('child_process');
8
+ import fs from 'fs';
9
+ import path from 'path';
10
+ import { execSync } from 'child_process';
11
+ import { fileURLToPath } from 'url';
11
12
 
12
- const [,, version, previousTag] = process.argv;
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = path.dirname(__filename);
13
15
 
14
- if (!version || !previousTag) {
15
- console.error('Usage: node scripts/generate-release-note.js <version> <previousTag>');
16
+ const [, , newVersionArg, previousVersionArg] = process.argv;
17
+
18
+ if (!newVersionArg) {
19
+ console.error('โŒ Usage: node scripts/generate-release-note.js <new-tag> <previous-tag?>');
20
+ process.exit(1);
21
+ }
22
+
23
+ const newVersion = newVersionArg.startsWith('v') ? newVersionArg : `v${newVersionArg}`;
24
+
25
+ // ๐Ÿ” Fallback to previous git tag
26
+ function resolvePreviousTag() {
27
+ try {
28
+ const tags = execSync('git tag --sort=-creatordate', { encoding: 'utf-8' })
29
+ .split('\n')
30
+ .filter(Boolean);
31
+ const idx = tags.indexOf(newVersion);
32
+ return tags[idx + 1] || tags[1] || null;
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+
38
+ const prevVersion = previousVersionArg || resolvePreviousTag();
39
+ if (!prevVersion) {
40
+ console.error('โŒ Could not resolve previous tag.');
16
41
  process.exit(1);
17
42
  }
18
43
 
19
- const templatePath = path.join(__dirname, '../.github/release-template.md');
20
- const outputPath = path.join(__dirname, `../docs-site/blog/${new Date().toISOString().split('T')[0]}-release-${version}.md`);
44
+ // ๐Ÿ“ฆ Get commits between versions
45
+ function getCommits(from, to) {
46
+ try {
47
+ return execSync(`git log ${from}..${to} --pretty=format:"- %s"`, { encoding: 'utf-8' });
48
+ } catch (err) {
49
+ console.error('โŒ Failed to fetch commits:', err.message);
50
+ process.exit(1);
51
+ }
52
+ }
53
+
54
+ function generateChangelogSection(commits) {
55
+ return `## ${newVersion}\n\n${commits}\n\n---\n`;
56
+ }
21
57
 
22
- const template = fs.readFileSync(templatePath, 'utf-8');
58
+ function generateBlogMarkdown(version, commits) {
59
+ const date = new Date().toISOString().slice(0, 10);
60
+ const slug = `release-${version}`;
61
+ return `---
62
+ slug: ${slug}
63
+ title: "๐Ÿš€ Version ${version} Released"
64
+ authors: [ali]
65
+ tags: [release, changelog]
66
+ ---
23
67
 
24
- // Count contributors
25
- const contributors = execSync(`git shortlog -sne ${previousTag}..HEAD | wc -l`).toString().trim();
26
- // Count commits
27
- const commits = execSync(`git rev-list --count ${previousTag}..HEAD`).toString().trim();
28
- // ISO date
29
- const date = new Date().toISOString().split('T')[0];
68
+ RAG Pipeline Utils **${version}** is now available on NPM!
30
69
 
31
- // Inject into template
32
- const filled = template
33
- .replace(/{{VERSION}}/g, version)
34
- .replace(/{{PREVIOUS_TAG}}/g, previousTag)
35
- .replace(/{{DATE}}/g, date)
36
- .replace(/{{CONTRIBUTORS}}/g, contributors)
37
- .replace(/{{COMMITS}}/g, commits);
70
+ ## ๐Ÿ”ง Changes
71
+
72
+ ${commits}
73
+
74
+ ## ๐Ÿ”— Resources
75
+
76
+ - GitHub Compare: [${prevVersion}...${version}](https://github.com/DevilsDev/rag-pipeline-utils/compare/${prevVersion}...${version})
77
+ - View full [CHANGELOG on GitHub](https://github.com/DevilsDev/rag-pipeline-utils/blob/main/CHANGELOG.md)
78
+ `;
79
+ }
80
+
81
+ const commits = getCommits(prevVersion, newVersion);
82
+ const blogContent = generateBlogMarkdown(newVersion, commits);
83
+ const changelogSection = generateChangelogSection(commits);
84
+
85
+ // ๐Ÿ“ Paths
86
+ const today = new Date().toISOString().slice(0, 10);
87
+ const blogPath = path.join(__dirname, `../docs-site/blog/${today}-${newVersion}.md`);
88
+ const changelogPath = path.join(__dirname, '../CHANGELOG.md');
89
+
90
+ // ๐Ÿ“ Write blog + changelog
91
+ fs.writeFileSync(blogPath, blogContent, 'utf-8');
92
+ fs.appendFileSync(changelogPath, `\n${changelogSection}`, 'utf-8');
93
+
94
+ // ๐Ÿ” Commit and push
95
+ try {
96
+ execSync('git config user.name "github-actions[bot]"');
97
+ execSync('git config user.email "41898282+github-actions[bot]@users.noreply.github.com"');
98
+ execSync('git add CHANGELOG.md docs-site/blog/*.md');
99
+ execSync(`git commit -m "docs(release): publish changelog and blog for ${newVersion}"`);
100
+ execSync('git push origin main');
101
+ console.log(`โœ… Blog + changelog committed for ${newVersion}`);
102
+ } catch (err) {
103
+ console.warn('โš ๏ธ Git commit skipped (already committed or no changes).');
104
+ }
38
105
 
39
- fs.writeFileSync(outputPath, filled);
40
- console.log(`โœ… Generated release blog: ${outputPath}`);
106
+ // ๐Ÿ“ฆ Local preview
107
+ console.log('\n๐Ÿ“˜ Blog Preview:\n');
108
+ console.log(blogContent);
109
+ console.log('\n๐Ÿ“˜ Changelog Section:\n');
110
+ console.log(changelogSection);
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Version: 1.0.0
3
+ * Description: Helper to find the previous Git semver tag before a given tag
4
+ * Usage: node scripts/get-previous-tag.js v2.1.5
5
+ * Output: v2.1.4
6
+ * Author: Ali Kahwaji
7
+ */
8
+
9
+ import { execSync } from 'child_process';
10
+
11
+ const currentTag = process.argv[2];
12
+
13
+ if (!currentTag) {
14
+ console.error('โŒ Usage: node get-previous-tag.js <current-tag>');
15
+ process.exit(1);
16
+ }
17
+
18
+ try {
19
+ // Ensure full tag history
20
+ execSync('git fetch --tags --unshallow 2>/dev/null || git fetch --tags', { stdio: 'inherit' });
21
+
22
+ // List all tags sorted by version (most recent last), remove current tag
23
+ const tags = execSync('git tag --sort=version:refname', { encoding: 'utf-8' })
24
+ .split('\n')
25
+ .map(tag => tag.trim())
26
+ .filter(Boolean);
27
+
28
+ const idx = tags.indexOf(currentTag);
29
+
30
+ if (idx <= 0) {
31
+ console.error('โš ๏ธ Could not find previous tag before', currentTag);
32
+ process.exit(1);
33
+ }
34
+
35
+ const previousTag = tags[idx - 1];
36
+ console.log(previousTag);
37
+ } catch (err) {
38
+ console.error('โŒ Failed to resolve previous tag:', err.message);
39
+ process.exit(1);
40
+ }
@@ -1,37 +0,0 @@
1
- # Version: 1.0.0
2
- # Description: Auto-commits CHANGELOG updates generated by tag-release CLI
3
- # Author: Ali Kahwaji
4
-
5
- name: ๐Ÿ“˜ Sync Changelog from CLI Tags
6
-
7
- on:
8
- push:
9
- tags:
10
- - 'v*'
11
-
12
- jobs:
13
- commit-changelog:
14
- runs-on: ubuntu-latest
15
- steps:
16
- - name: โฌ‡๏ธ Checkout repo
17
- uses: actions/checkout@v4
18
-
19
- - name: ๐Ÿงฐ Setup Node.js
20
- uses: actions/setup-node@v4
21
- with:
22
- node-version: 20
23
-
24
- - name: ๐Ÿ“ฆ Install
25
- run: npm ci
26
-
27
- - name: ๐Ÿ“ Append Changelog Entry
28
- run: |
29
- VERSION=${GITHUB_REF#refs/tags/v}
30
- node scripts/tag-release.js $VERSION
31
- cat scripts/.cache/v$VERSION.log >> CHANGELOG.md
32
-
33
- - name: ๐Ÿ” Commit changelog
34
- uses: stefanzweifel/git-auto-commit-action@v5
35
- with:
36
- commit_message: "docs(changelog): update for v${{ github.ref_name }}"
37
- file_pattern: "CHANGELOG.md"