Skip to content

Commit

Permalink
chore: add auto release and commit config
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdip-b committed Jan 27, 2024
1 parent 9090870 commit b8d820e
Show file tree
Hide file tree
Showing 8 changed files with 212 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .auto-changelog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"output": "CHANGELOG.md",
"sortCommits": "date-desc",
"commitLint": false
}
81 changes: 81 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$NEXT_PATCH_VERSION'
categories:
- title: 'Features'
labels:
- 'type: feature'

- title: 'Breaking Changes'
labels:
- 'type: breaking'

- title: 'Documentation'
labels:
- 'type: docs'

- title: 'Bug Fixes'
labels:
- 'type: fix'

- title: 'Patches'
labels:
- 'type: chore'
- 'type: tests'
- 'type: patch'

- title: 'Miscellaneous'
labels:
- 'type: misc'

change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&'

version-resolver:
major:
labels:
- 'type: breaking'
minor:
labels:
- 'type: feature'

patch:
labels:
- 'type: fix'
- 'type: chore'
- 'type: docs'
- 'type: bug'
- 'type: testing'
default: patch

exclude-labels:
- 'release: skip changelog'

template: |
## Changes
$CHANGES
autolabeler:
- label: 'type: chore'
title:
- /chore/i
- /refactor/i

- label: 'type: fix'
title:
- /fix/i
- /hotfix/i
- /bugfix/i
- /patch/i

- label: 'type: feature'
title:
- /feat/i
- /feature/i
- /enhancement/i
- /new/i

- label: 'type: docs'
title:
- /doc/i
- /docs/i
20 changes: 20 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release Drafter

on:
push:
branches:
- release
- alpha
- chore/changelog

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
with:
config-name: release_drafter.yml
disable-autolabeler: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
/.nx/cache
auto-changelog-template.hbs
10 changes: 0 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +0,0 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

- Initial release
52 changes: 52 additions & 0 deletions auto-changelog-template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{#each releases}}
{{#if href}}
## [{{title}}]({{href}}){{#if tag}} - {{isoDate}}{{/if}}
{{else}}
## {{title}}{{#if tag}} - {{isoDate}}{{/if}}
{{/if}}

{{#if merges}}
### Community Contributions
{{#commit-list merges heading='#### Breaking Changes' message='.*BREAKING.*'}}
- {{message}} [`{{id}}`]({{href}})
{{/commit-list}}

{{#commit-list merges heading='#### Bug Fix' message='^fix.*$' exclude='.*BREAKING.*'}}
- {{message}} [`{{id}}`]({{href}})
{{/commit-list}}

{{#commit-list merges heading='#### Patches' message='^chore|tests|patch|test.*$' exclude='.*BREAKING.*'}}
- {{message}} [`{{id}}`]({{href}})
{{/commit-list}}

{{#commit-list merges heading='#### Documentation' message='^docs|GITBOOK.*$' exclude='.*BREAKING.*'}}
- {{message}} [`{{id}}`]({{href}})
{{/commit-list}}

{{#commit-list merges heading='#### Miscellaneous' message='.*' exclude='(^docs|GITBOOK|chore|tests|patch|test|fix.*)|(.*BREAKING.*)'}}
- {{message}} [`{{id}}`]({{href}})
{{/commit-list}}
{{/if}}

### Team Contributions
{{#commit-list commits heading='#### Breaking Changes' message='.*BREAKING.*'}}
- {{message}} [`{{shorthash}}`]({{href}})
{{/commit-list}}

{{#commit-list commits heading='#### Bug Fix' message='^fix.*$' exclude='.*BREAKING.*'}}
- {{message}} [`{{shorthash}}`]({{href}})
{{/commit-list}}

{{#commit-list commits heading='#### Patches' message='^chore|tests|patch|test.*$' exclude='.*BREAKING.*'}}
- {{message}} [`{{shorthash}}`]({{href}})
{{/commit-list}}

{{#commit-list commits heading='#### Documentation' message='^docs|GITBOOK.*$' exclude='.*BREAKING.*'}}
- {{message}} [`{{shorthash}}`]({{href}})
{{/commit-list}}

{{#commit-list commits heading='#### Miscellaneous' message='.*' exclude='(^docs|GITBOOK|chore|tests|patch|test|fix.*)|(.*BREAKING.*)'}}
- {{message}} [`{{shorthash}}`]({{href}})
{{/commit-list}}

{{/each}}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"db:validate": "nx run api:prisma:validate",
"db:format": "nx run api:prisma:format",
"db:reset": "nx run api:prisma:reset",
"prepare": "husky install"
"prepare": "husky install",
"generate-changelog": "npx auto-changelog -c .auto-changelog.json --template auto-changelog-template.hbs"
},
"private": false,
"devDependencies": {
Expand Down Expand Up @@ -100,6 +101,7 @@
"@nestjs/swagger": "^7.1.17",
"@prisma/client": "^5.7.1",
"@supabase/supabase-js": "^2.39.2",
"auto-changelog": "^2.4.0",
"axios": "^1.6.5",
"chalk": "4.1.2",
"class-transformer": "^0.5.1",
Expand Down
52 changes: 49 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b8d820e

Please sign in to comment.