semantic-release / changelog

:blue_book: semantic-release plugin to create or update a changelog file
MIT License
304 stars 28 forks source link

Please anyone helps me to setup custom template for changelog #397

Open MDmubarak786 opened 3 months ago

MDmubarak786 commented 3 months ago

Package.json file

{
  "name": "test",
  "version": "1.6.1",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "14.2.5",
    "react": "^18",
    "react-dom": "^18"
  },
  "devDependencies": {
    "@semantic-release/changelog": "^6.0.3",
    "@semantic-release/commit-analyzer": "^13.0.0",
    "@semantic-release/exec": "^6.0.3",
    "@semantic-release/git": "^10.0.1",
    "@semantic-release/github": "^10.1.5",
    "@semantic-release/npm": "^12.0.1",
    "@semantic-release/release-notes-generator": "^14.0.1",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "commitizen": "^4.3.0",
    "conventional-changelog-conventionalcommits": "^8.0.0",
    "cz-conventional-changelog": "^3.3.0",
    "eslint": "^8",
    "eslint-config-next": "14.2.5",
    "postcss": "^8",
    "semantic-release": "^24.0.0",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  },
  "release": {
    "plugins": [
      "@semantic-release/commit-analyzer",
      [
        "@semantic-release/release-notes-generator",
        {
          "writerOpts": {
            "mainTemplate": "./changelog-template.hbs"
          }
        }
      ],
      [
        "@semantic-release/changelog",
        {
          "changelogTitle": "# 🚀 Release Notes",
          "changelogFile": "CHANGELOG.md"
        }
      ],
      "@semantic-release/git",
      "@semantic-release/github"
    ]
  },
  "config": {
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  }
}

This is template file

# 🚀 Release Notes

{{#if version}}
## 📦 Version {{version}}
{{/if}}

{{#if date}}
⏰ Released on: {{date}}
{{/if}}

{{#if commits}}
## ✨ Commits

{{#each commits}}
- {{#if this.breaking}}💥 BREAKING CHANGE: {{/if}}{{#if this.type}}({{this.type}}) {{/if}}{{this.scope}}:
{{this.subject}}
{{/each}}
{{/if}}

{{#if noteGroups}}
## 📋 Notes

{{#each noteGroups}}
### {{title}}

{{#each notes}}
- {{text}}
{{/each}}

{{/each}}
{{/if}}

{{#if issues}}
## 🐛 Fixed Issues

{{#each issues}}
- {{this}}
{{/each}}
{{/if}}

{{#if merges}}
## 🔀 Merged Pull Requests

{{#each merges}}
- {{this}}
{{/each}}
{{/if}}

Please let me know what I might be missing—my template changes aren't reflecting in the changelog.