Skip to content

Commit

Permalink
docs(changelog): add git-cliff
Browse files Browse the repository at this point in the history
  • Loading branch information
DeadNews committed Apr 8, 2024
1 parent 176ca51 commit ec369de
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

publish:
name: Publish Package to npmjs
if: startsWith(github.ref, 'refs/tags/')
if: github.ref_type == 'tag'
needs: [tests]
permissions:
contents: write
Expand Down
2 changes: 2 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[files]
extend-exclude = ["CHANGELOG.md"]
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Changelog

## [unreleased]

### 👷 Build

- _(docker)_ fix `docker-compose` - ([ce16f1b](https://github.com/DeadNews/deadnews-template-typescript/commit/ce16f1ba90061d623b567d582ff70cd812459aa7))
- _(docker)_ update `Dockerfile` - ([bf02ec8](https://github.com/DeadNews/deadnews-template-typescript/commit/bf02ec8003a747a8dcd093fe8f033b8b8504e413))
- _(docker)_ fix `docker-compose` - ([b3ccfa0](https://github.com/DeadNews/deadnews-template-typescript/commit/b3ccfa023d48f04500d6cc46547c998f52fcb46d))
- _(docker)_ update `Dockerfile` - ([8d9fd21](https://github.com/DeadNews/deadnews-template-typescript/commit/8d9fd21556748ecc0a8a9442ae0bcb48edb304b6))

### ⚙️ CI/CD

- _(pre-commit)_ add `checkmake` hook - ([9072c87](https://github.com/DeadNews/deadnews-template-typescript/commit/9072c8737ce0564637ea71775784e7e8710edbc5))

## [0.1.3](https://github.com/DeadNews/deadnews-template-typescript/compare/v0.1.2...v0.1.3) - 2023-10-01

### 🚀 Features

- init ([#1](https://github.com/DeadNews/deadnews-template-python/issues/1)) - ([5d78af4](https://github.com/DeadNews/deadnews-template-typescript/commit/5d78af48de88fc72f2265806425d81f8b8153991))

### 📚 Documentation

- _(readme)_ add badge - ([759016f](https://github.com/DeadNews/deadnews-template-typescript/commit/759016f8e376e204e27e73e69ad460761a36df5d))

### 🧹 Chores

- _(vscode)_ update settings - ([acafff0](https://github.com/DeadNews/deadnews-template-typescript/commit/acafff091fb72fcaaf25f24a38857a22684f0419))
- bump version - ([63f6083](https://github.com/DeadNews/deadnews-template-typescript/commit/63f6083e6f2a2adb72b211cf73fe26ceaf9bfa5b))

### 👷 Build

- _(dockerfile)_ expose port - ([c122f0a](https://github.com/DeadNews/deadnews-template-typescript/commit/c122f0a173aaffc59c20f3a247433f8cdc213cc0))

### ⚙️ CI/CD

- use `npmjs` deploy environment - ([c1da5c0](https://github.com/DeadNews/deadnews-template-typescript/commit/c1da5c0218d6c396f9ef8f737abc7c0d8331c0d5))
- update `main` workflow ([#4](https://github.com/DeadNews/deadnews-template-python/issues/4)) - ([9b99ca3](https://github.com/DeadNews/deadnews-template-typescript/commit/9b99ca3ddd9bd62899e0a215a2c3ead6ec2e678c))

<!-- generated by git-cliff -->
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM oven/bun:1.1.2-alpine@sha256:e9f01a4ed78e4d829a06c7f490a6696bfa5f252fcde2d7cb9c4e6b9be721b91a as base
LABEL maintainer "DeadNews <aurczpbgr@mozmail.com>"
LABEL maintainer "DeadNews <deadnewsgit@gmail.com>"

WORKDIR /app

Expand Down
27 changes: 18 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
.PHONY: all clean test checks docker
.PHONY: all clean test default checks pc

checks: pc-run
default: checks

pc-run:
pre-commit run -a
checks: pc

docker: compose-up
pc:
pre-commit run -a

compose-up:
docker compose up --build
bumped:
git cliff --bumped-version

compose-down:
docker compose down
# make release-tag_name
# make release-$(git cliff --bumped-version)-alpha.0
release-%: checks
git cliff -o CHANGELOG.md --tag $*
pre-commit run --files CHANGELOG.md || pre-commit run --files CHANGELOG.md
git add CHANGELOG.md
git commit -m "chore(release): prepare for $*"
git push
git tag -a $* -m "chore(release): $*"
git push origin $*
git tag --verify $*
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

> TypeScript Project Template
[![npm](https://img.shields.io/npm/v/deadnews-template-typescript)](https://www.npmjs.com/package/deadnews-template-typescript)
[![Main](https://github.com/DeadNews/deadnews-template-typescript/actions/workflows/main.yml/badge.svg)](https://github.com/DeadNews/deadnews-template-typescript/actions/workflows/main.yml)
[![pre-commit.ci](https://results.pre-commit.ci/badge/github/DeadNews/deadnews-template-typescript/main.svg)](https://results.pre-commit.ci/latest/github/DeadNews/deadnews-template-typescript/main)
[![Docker](https://github.com/DeadNews/deadnews-template-typescript/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/DeadNews/deadnews-template-typescript/actions/workflows/docker-publish.yml)
[![image-size](https://ghcr-badge.egpl.dev/DeadNews/deadnews-template-typescript/size)](https://github.com/DeadNews/deadnews-template-typescript/pkgs/container/deadnews-template-typescript)
[![npm](https://img.shields.io/npm/v/deadnews-template-typescript?logo=npm&logoColor=white)](https://www.npmjs.com/package/deadnews-template-typescript)
[![GitHub: Release](https://img.shields.io/github/v/release/deadnews/deadnews-template-typescript?logo=github&logoColor=white)](https://github.com/deadnews/deadnews-template-typescript/releases/latest)
[![Docker: ghcr](https://img.shields.io/badge/docker-gray.svg?logo=docker&logoColor=white)](https://github.com/deadnews/deadnews-template-typescript/pkgs/container/deadnews-template-typescript)
[![CI: pre-commit](https://results.pre-commit.ci/badge/github/DeadNews/deadnews-template-typescript/main.svg)](https://results.pre-commit.ci/latest/github/DeadNews/deadnews-template-typescript/main)
[![CI: Main](https://img.shields.io/github/actions/workflow/status/deadnews/deadnews-template-typescript/main.yml?branch=main&logo=github&logoColor=white&label=main)](https://github.com/deadnews/deadnews-template-typescript/actions/workflows/main.yml)
85 changes: 85 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# git-cliff ~ configuration file
# https://git-cliff.org/docs/configuration

[changelog]
header = """
# Changelog\n
"""
postprocessors = [
{ pattern = '<REPO>', replace = "https://github.com/DeadNews/deadnews-template-typescript" },
]
body = """
{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
{% macro print_commit(commit) -%}
- {% if commit.scope %}_({{ commit.scope }})_ {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message }} - \
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
{% endmacro -%}
{% if version %}\
{% if previous.version %}\
## [{{ version | trim_start_matches(pat="v") }}]\
({{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% endif %}\
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
{{ self::print_commit(commit=commit) }}
{%- endfor -%}
{% raw %}\n{% endraw %}\
{%- for commit in commits %}
{%- if not commit.scope -%}
{{ self::print_commit(commit=commit) }}
{% endif -%}
{% endfor -%}
{% endfor %}\n
"""
footer = """
<!-- generated by git-cliff -->
"""
trim = true

[git]
conventional_commits = true # parse the commits based on https://www.conventionalcommits.org
filter_unconventional = true # filter out the commits that are not conventional
split_commits = false # process each line of a commit as an individual commit
commit_preprocessors = [
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))" }, # Replace github issue numbers
{ pattern = " +", replace = " " }, # Remove multiple whitespaces
]
commit_parsers = [
{ message = "^(ci|build|chore)\\(deps.*\\)", skip = true },
{ message = "^chore\\(release\\)", skip = true },
{ message = "^fix\\(deps.*\\)", group = "<!-- 92 -->⬆️ Dependencies" },
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug fixes" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^chore", group = "<!-- 7 -->🧹 Chores" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^build", group = "<!-- 9 -->👷 Build" },
{ message = "^ci", group = "<!-- 91 -->⚙️ CI/CD" },
{ message = "^revert", group = "<!-- 93 -->◀️ Revert" },
]
protect_breaking_commits = true
filter_commits = false # filter out the commits that are not matched by commit parsers
tag_pattern = "v[0-9].*" # regex for matching git tags
skip_tags = "" # drop commits from the changelog
ignore_tags = "rc|beta|alpha" # include ignored commits into the next tag
topo_order = false # sort the tags topologically
sort_commits = "newest" # sort the commits inside sections by oldest/newest order
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "deadnews-template-typescript",
"version": "0.1.3",
"description": "TypeScript Project Template",
"publisher": "DeadNews <aurczpbgr@mozmail.com>",
"publisher": "DeadNews <deadnewsgit@gmail.com>",
"homepage": "https://github.com/DeadNews/deadnews-template-typescript",
"license": "MIT",
"module": "src/index.ts",
Expand Down

0 comments on commit ec369de

Please sign in to comment.