Skip to content

Commit

Permalink
docs(changelog): add git-cliff (#131)
Browse files Browse the repository at this point in the history
* docs(readme): update badges
* docs(changelog): add `git-cliff`
* docs(mkdocs): add `navigation.instant`
  • Loading branch information
DeadNews committed Apr 8, 2024
1 parent de195d1 commit 7dd822e
Show file tree
Hide file tree
Showing 9 changed files with 272 additions and 16 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Main
on:
push:
branches: [main]
tags:
- "v*"
pull_request:
branches: [main]
release:
types: [created]

permissions:
contents: read
Expand Down Expand Up @@ -69,13 +69,13 @@ jobs:
if: matrix.os == 'ubuntu-latest' && matrix.firebird-version == '2.5-sc' && matrix.python-version == '3.12'
uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5

publish-pypi:
pypi-deploy:
name: Release to PyPI
if: github.event_name == 'release' && github.event.action == 'created'
if: github.ref_type == 'tag'
needs: [lint, tests]
environment: pypi
permissions:
id-token: write
environment: pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -93,9 +93,33 @@ jobs:
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14

github-deploy:
name: Release to GitHub
if: github.ref_type == 'tag'
needs: [lint, tests]
environment: github-releases
permissions:
contents: write
env:
CHANGELOG: https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md
PRERELEASE: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create GitHub Release
run: |
gh release create ${{ github.ref_name }} \
--title ${{ github.ref_name }} \
--notes="See [the CHANGELOG](${{ env.CHANGELOG }}) for more details." \
--draft=${{ env.PRERELEASE }} \
--prerelease=${{ env.PRERELEASE }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docs-build:
name: Build docs
if: github.event_name == 'release' && github.event.action == 'created'
if: github.ref_type == 'tag'
needs: [lint, tests]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -124,7 +148,7 @@ jobs:

docs-deploy:
name: Deploy docs
if: github.event.release.prerelease != true
if: true && !contains(github.ref, 'alpha')
needs: [docs-build]
environment:
name: github-pages
Expand Down
3 changes: 3 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[files]
extend-exclude = ["CHANGELOG.md"]

[default.extend-words]
COMMITED = "COMMITED"
125 changes: 125 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Changelog

## [1.1.2-beta.1](https://github.com/DeadNews/firebirdsql-run/compare/v1.1.1...v1.1.2-beta.1) - 2024-04-08

### 📚 Documentation

- _(changelog)_ add `git-cliff` - ([a9d4baf](https://github.com/DeadNews/firebirdsql-run/commit/a9d4baf4c560797b9f298e4275a534ec07a5046e))
- _(changelog)_ add `git-cliff` - ([65fe4e2](https://github.com/DeadNews/firebirdsql-run/commit/65fe4e2bd5928936dde263f5eedcc00da01d5088))
- _(mkdocs)_ add `navigation.instant` - ([3bb011f](https://github.com/DeadNews/firebirdsql-run/commit/3bb011fb2e0ddf69b5ba393bac772ef9da71bf71))
- _(mkdocs)_ update ([#130](https://github.com/DeadNews/firebirdsql-run/issues/130)) - ([dabaf63](https://github.com/DeadNews/firebirdsql-run/commit/dabaf636900d12d9ba865be08ab06a37340cf5d6))
- _(readme)_ update badges - ([0ef83eb](https://github.com/DeadNews/firebirdsql-run/commit/0ef83ebe41dfd240bd28798db48305f7364e1882))
- _(readme)_ update badges - ([f6195c9](https://github.com/DeadNews/firebirdsql-run/commit/f6195c98a8a54719b803f6763d986ba4bdd6c210))
- _(readme)_ add badges - ([10bca60](https://github.com/DeadNews/firebirdsql-run/commit/10bca6066a19a04eaa6b883fb228c74228d35775))
- update docstrings - ([860dc75](https://github.com/DeadNews/firebirdsql-run/commit/860dc75a198162093ee703d4c7dc6c7cb33f4ea7))

## [1.1.1](https://github.com/DeadNews/firebirdsql-run/compare/v1.0.7...v1.1.1) - 2024-02-26

### 🚀 Features

- add `port` attribute to `CompletedTransaction` - ([db144a4](https://github.com/DeadNews/firebirdsql-run/commit/db144a4913a76fe16c4058c9f6c9257e8da29d89))
- add new parameter `access: read_write|read_only` ([#118](https://github.com/DeadNews/firebirdsql-run/issues/118)) - ([821489a](https://github.com/DeadNews/firebirdsql-run/commit/821489a8422e067934ee78fe731a62aceaf68d3e))

### 🐛 Bug fixes

- move line from the `try` block - ([91cbe3a](https://github.com/DeadNews/firebirdsql-run/commit/91cbe3a8e9824b7126dcbf435aa66e4cf7f47b59))
- adjust typing ([#111](https://github.com/DeadNews/firebirdsql-run/issues/111)) - ([43c2e7e](https://github.com/DeadNews/firebirdsql-run/commit/43c2e7ee9ce1a458f5d11f3d45e2640603a52df8))

### 🚜 Refactor

- `execute` function ([#122](https://github.com/DeadNews/firebirdsql-run/issues/122)) - ([ae3b993](https://github.com/DeadNews/firebirdsql-run/commit/ae3b99399bf374926cb5b3267cc486b21c36978e))

### 📚 Documentation

- _(readme)_ fix typo - ([3ff59a2](https://github.com/DeadNews/firebirdsql-run/commit/3ff59a2cfaaef6673adf5d32c59b58df9f0f63c8))
- add `mkdocs` ([#125](https://github.com/DeadNews/firebirdsql-run/issues/125)) - ([fb002ed](https://github.com/DeadNews/firebirdsql-run/commit/fb002ed85cd31c94b8e16c3d25a61adc1b462596))

### 🧹 Chores

- add config for `toml` formatter - ([8671ed2](https://github.com/DeadNews/firebirdsql-run/commit/8671ed22d9eae76b99d23960ae30ff47feda6088))
- update `ruff` settings - ([19894ca](https://github.com/DeadNews/firebirdsql-run/commit/19894caada7de2608a96610eb0b7734f29361be7))
- replace `black` with `ruff` - ([2c90e26](https://github.com/DeadNews/firebirdsql-run/commit/2c90e261a92a85fc5a5d033ff5e4c1d3bd37d050))

### ⚙️ CI/CD

- _(pre-commit)_ add `checkmake` hook - ([3baa8d6](https://github.com/DeadNews/firebirdsql-run/commit/3baa8d6d1ac7a0efba93f1155b4bb48f0ef1385b))
- _(pre-commit)_ add `actionlint` hook - ([2cd0df6](https://github.com/DeadNews/firebirdsql-run/commit/2cd0df6b93ef362b79cc8bafbaa8a8bceafd82dc))
- update `firebird` versions in tests matrix ([#121](https://github.com/DeadNews/firebirdsql-run/issues/121)) - ([69330a8](https://github.com/DeadNews/firebirdsql-run/commit/69330a89bfe059a2a899206395129c8814d735e3))
- add `python 3.12` to tests matrix ([#93](https://github.com/DeadNews/firebirdsql-run/issues/93)) - ([ab7978e](https://github.com/DeadNews/firebirdsql-run/commit/ab7978e834654cc5b63c328ac895f620ef65e5f1))

### ⬆️ Dependencies

- _(deps)_ update dependency firebirdsql to v1.2.5 ([#124](https://github.com/DeadNews/firebirdsql-run/issues/124)) - ([e72e63b](https://github.com/DeadNews/firebirdsql-run/commit/e72e63b292d4b8c3635897da42952cb516b0901a))
- _(deps)_ update dependency firebirdsql to v1.2.3 ([#110](https://github.com/DeadNews/firebirdsql-run/issues/110)) - ([623fbbc](https://github.com/DeadNews/firebirdsql-run/commit/623fbbcb361a2c3134a5990cb119a7004fccc0e3))

## [1.0.7](https://github.com/DeadNews/firebirdsql-run/compare/v1.0.6...v1.0.7) - 2023-09-12

### 📚 Documentation

- update `README` - ([b8cc602](https://github.com/DeadNews/firebirdsql-run/commit/b8cc6028a06b8be398e6b4fe0b9adf44bbf32db5))

### 🧹 Chores

- update docstrings ([#88](https://github.com/DeadNews/firebirdsql-run/issues/88)) - ([1e66d51](https://github.com/DeadNews/firebirdsql-run/commit/1e66d514d7b11b4278776e7392b9fb93d81e69fb))
- specify python `target-version` - ([b2a354a](https://github.com/DeadNews/firebirdsql-run/commit/b2a354a253b613d3aa4b1f9c4912e7260e41b003))

### ⚙️ CI/CD

- _(pre-commit)_ use `black` mirror ([#87](https://github.com/DeadNews/firebirdsql-run/issues/87)) - ([078ee6d](https://github.com/DeadNews/firebirdsql-run/commit/078ee6d99b63d0239dfc1661a2e278ff38418d7e))
- disable `codeql` on `schedule` - ([1b3afc8](https://github.com/DeadNews/firebirdsql-run/commit/1b3afc84d701461d4dbb2f8348f80286adaa9eb6))

## [1.0.6](https://github.com/DeadNews/firebirdsql-run/compare/v1.0.5...v1.0.6) - 2023-07-18

### 🚜 Refactor

- force ipv4 `localhost` - ([7834fef](https://github.com/DeadNews/firebirdsql-run/commit/7834fef4fa047b0f91025854f946aa77bb2225aa))

### ⚙️ CI/CD

- move `pytest` command - ([5b3018f](https://github.com/DeadNews/firebirdsql-run/commit/5b3018fe10c01f134b7bcc8512b072bb221258a9))

## [1.0.5](https://github.com/DeadNews/firebirdsql-run/compare/v1.0.4...v1.0.5) - 2023-07-08

### 🐛 Bug fixes

- move connection close to `finally` block ([#78](https://github.com/DeadNews/firebirdsql-run/issues/78)) - ([83f4fbb](https://github.com/DeadNews/firebirdsql-run/commit/83f4fbba59f6db8d18a41f415b6b0b6dcb43c7da))

### 🧹 Chores

- ignore `PLR0913` ruff rule - ([3a50234](https://github.com/DeadNews/firebirdsql-run/commit/3a502341355a51977bc39142b591fb4bf6bcad67))

### ⚙️ CI/CD

- _(renovate)_ adjust schedule - ([957e8d0](https://github.com/DeadNews/firebirdsql-run/commit/957e8d0e1f2de9440c04a9f5ecce89104ccdb51a))
- use `digest pinning` - ([2ff20ff](https://github.com/DeadNews/firebirdsql-run/commit/2ff20ff20396edd660a8f39eb50da755ed721ef7))

## [1.0.4](https://github.com/DeadNews/firebirdsql-run/compare/v1.0.3...v1.0.4) - 2023-05-30

### 🚜 Refactor

- separate modules ([#69](https://github.com/DeadNews/firebirdsql-run/issues/69)) - ([42eb6f1](https://github.com/DeadNews/firebirdsql-run/commit/42eb6f147cafa6affe6b1bd7ccd5a109f0a5be99))

### 📚 Documentation

- _(README)_ update - ([e84ba3e](https://github.com/DeadNews/firebirdsql-run/commit/e84ba3e8e2f72a8dcad43f8ac3c768527ca199bd))

## [1.0.3](https://github.com/DeadNews/firebirdsql-run/compare/v1.0.2...v1.0.3) - 2023-05-25

### 🚀 Features

- get passwd from `env` by default ([#68](https://github.com/DeadNews/firebirdsql-run/issues/68)) - ([da76539](https://github.com/DeadNews/firebirdsql-run/commit/da7653955cb8c4501fc917df0822f8be2405fb22))

### ⚙️ CI/CD

- _(pre-commit)_ add `typos` hook - ([a0a0731](https://github.com/DeadNews/firebirdsql-run/commit/a0a0731c906bb60a881633217a135a23f38a00ca))
- _(pre-commit)_ adjust schedule and rules - ([60d18c3](https://github.com/DeadNews/firebirdsql-run/commit/60d18c384eba08d57e07f0c2594de4a07463ddb0))
- _(renovate)_ use shared config - ([4a83cc4](https://github.com/DeadNews/firebirdsql-run/commit/4a83cc46b63fe1d75e5f95719f4f4bb652b3b5d8))
- update `workflows` ([#64](https://github.com/DeadNews/firebirdsql-run/issues/64)) - ([a437498](https://github.com/DeadNews/firebirdsql-run/commit/a4374984035d5f77d20639d94a35e68dc4eeb152))

## [1.0.2] - 2023-05-07

### 🚀 Features

- dev pr ([#55](https://github.com/DeadNews/firebirdsql-run/issues/55)) - ([de9b63e](https://github.com/DeadNews/firebirdsql-run/commit/de9b63eaafe6e90aff540aa1e8c50be08f72da02))

<!-- generated by git-cliff -->
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,18 @@ test-integration:
docker compose -f docker-compose.test.yml up -d
poetry run pytest
docker compose -f docker-compose.test.yml down

bumped:
git cliff --bumped-version

# 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 $*
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

> [Firebirdsql](https://github.com/nakagami/pyfirebirdsql/) wrapper inspired by [subprocess.run](https://docs.python.org/3/library/subprocess.html#subprocess.run)
[![PyPI version](https://img.shields.io/pypi/v/firebirdsql-run)](https://pypi.org/project/firebirdsql-run)
[![GitHub Release](https://img.shields.io/github/v/release/deadnews/firebirdsql-run)](https://github.com/DeadNews/firebirdsql-run/releases/latest)
[![Documentation](https://img.shields.io/badge/docs-github-blue.svg)](https://deadnews.github.io/firebirdsql-run)
[![Main](https://github.com/DeadNews/firebirdsql-run/actions/workflows/main.yml/badge.svg)](https://github.com/DeadNews/firebirdsql-run/actions/workflows/main.yml)
[![pre-commit.ci](https://results.pre-commit.ci/badge/github/DeadNews/firebirdsql-run/main.svg)](https://results.pre-commit.ci/latest/github/DeadNews/firebirdsql-run/main)
[![codecov](https://codecov.io/gh/DeadNews/firebirdsql-run/branch/main/graph/badge.svg?token=OCZDZIYPMC)](https://codecov.io/gh/DeadNews/firebirdsql-run)

**[Installation](#installation)****[Examples](#examples)****[Env Variables](#env-variables)****[API Reference](https://deadnews.github.io/firebirdsql-run/reference)**
[![PyPI: Version](https://img.shields.io/pypi/v/firebirdsql-run?logo=pypi&logoColor=white)](https://pypi.org/project/firebirdsql-run)
[![GitHub: Release](https://img.shields.io/github/v/release/deadnews/firebirdsql-run?logo=github&logoColor=white)](https://github.com/deadnews/firebirdsql-run/releases/latest)
[![Documentation](https://img.shields.io/badge/documentation-gray.svg?logo=materialformkdocs&logoColor=white)](https://deadnews.github.io/firebirdsql-run)
[![CI: pre-commit](https://results.pre-commit.ci/badge/github/DeadNews/firebirdsql-run/main.svg)](https://results.pre-commit.ci/latest/github/deadnews/firebirdsql-run/main)
[![CI: Main](https://img.shields.io/github/actions/workflow/status/deadnews/firebirdsql-run/main.yml?branch=main&logo=github&logoColor=white&label=main)](https://github.com/deadnews/firebirdsql-run/actions/workflows/main.yml)
[![CI: Coverage](https://img.shields.io/codecov/c/github/deadnews/firebirdsql-run?token=OCZDZIYPMC&logo=codecov&logoColor=white)](https://app.codecov.io/gh/deadnews/firebirdsql-run)

**[Installation](#installation)****[Examples](#examples)****[Env Variables](#env-variables)**

## Installation

Expand Down
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/firebirdsql-run" },
]
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
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--8<-- "CHANGELOG.md"
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ edit_uri: blob/main/docs/

nav:
- Overview: index.md
- Changelog: changelog.md
# defer to gen-files + literate-nav
- API reference: reference/

watch:
- src
- README.md
- CHANGELOG.md

theme:
name: material
Expand Down Expand Up @@ -38,6 +40,7 @@ theme:
- navigation.expand
- navigation.footer
- navigation.indexes
- navigation.instant
- navigation.sections
- navigation.tabs
- navigation.top
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "poetry_dynamic_versioning.backend"
name = "firebirdsql-run"
version = "0.0.0"
description = "Firebirdsql wrapper inspired by subprocess.run"
authors = ["DeadNews <aurczpbgr@mozmail.com>"]
authors = ["DeadNews <deadnewsgit@gmail.com>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/deadnews/firebirdsql-run"
Expand Down

0 comments on commit 7dd822e

Please sign in to comment.