Skip to content

Commit f2fa815

Browse files
committed
feat(plugin): add plugin, commit message questions, changelog template (#1)
* feat(plugin): add plugin, commit message questions and changelog template - reads options from target project "pyproject.toml" - changelog mapping dynamically from types - switch for disable emoji from target project "pyproject.toml" - configured bump_pattern and bump_map for changelog - add commit parser passing conventional-commit-linter rules and changelog hooks - switch for disable section "Unreleased" from target project "pyproject.toml" - "change_type_order" possible set from from target project "pyproject.toml" - add "cz info" (short info) and "cz example" (full example) to the CLI commands - add customizable changelog title, header and footer - ci: versions from scm_tools - ci: updated to support Python 3.9 * docs(readme): add basic usage and configuration * ci(github-actions): replace publish-pypi workflow with PYPA version * fix(changelog): update changelog builder to be compatible with mdformat linter * fix(changelog): do not add changelog headers when "cz bump" * ci: update .gitignore file, remove TODO.md * fix(template): fixed Changelog template - displaying w/wo authors, commits * fix(changelog): fix custom header,title,footer, update defaults * docs(readme): update examples with comments * feat: add pre-commit hook for autoupdate CHANGELOG * change(bump): release 0.2.6 → 0.3.0 [skip-ci] * ci(pre-commit): ignore hook "update-changelog" in CI * change(bump): release 0.3.0 → 0.3.1 [skip-ci] * docs(readme): update GitHub badges, add pypi and compatible python
1 parent d8f208c commit f2fa815

22 files changed

+1104
-104
lines changed

.github/workflows/pre-commit.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
jobs:
88
check-pre-commit:
99
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
1012
steps:
1113
- name: Checkout repository
1214
uses: actions/checkout@v4
@@ -17,4 +19,4 @@ jobs:
1719
- name: Run pre-commit
1820
uses: pre-commit/[email protected]
1921
env:
20-
SKIP: pip-compile
22+
SKIP: pip-compile,update-changelog

.github/workflows/pypa-publish-pypi.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ on:
77
release:
88
types: [created]
99
workflow_dispatch:
10-
inputs:
11-
tag_name:
12-
description: 'Tag name to release'
13-
required: false
1410

1511
jobs:
1612
pypi-build-publish:
@@ -28,26 +24,13 @@ jobs:
2824
with:
2925
python-version: ${{ matrix.python-version }}
3026

31-
- name: Get tag name from input or Git
32-
id: get_tag
33-
run: |
34-
if [ "${{ github.event.inputs.tag_name }}" ]; then
35-
echo "TAG=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
36-
else
37-
echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
38-
fi
39-
40-
- name: Display tag
41-
run: echo "Releasing version $TAG"
42-
4327
- name: Install dependencies
4428
run: |-
4529
python -m pip install --upgrade pip
4630
pip install build
4731
4832
- name: Build package
49-
run: |-
50-
python -m build
33+
run: python -m build
5134

5235
- name: Publish package distributions to PyPI
5336
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88
/docs/_build/
99
*.egg-info/
1010
__pycache__/
11+
_version.py
12+
TODO.md

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ repos:
5757
additional_dependencies:
5858
- mdformat-gfm # Support for GitHub Flavored Markdown (GFM), including tables, task lists, strikethroughs, and autolinks.
5959
- mdformat-ruff # Formats Python code blocks in Markdown files according to the `ruff` linter's style.
60-
- mdformat-simple-breaks # Ensures that single line breaks in Markdown are converted to `<br>` t
60+
- mdformat-simple-breaks # Ensures that single line breaks in Markdown are converted to `<br>`
6161

6262
- repo: https://github.com/Yelp/detect-secrets
6363
rev: v1.5.0
@@ -81,3 +81,11 @@ repos:
8181
language: system
8282
pass_filenames: false
8383
files: requirements.txt|pyproject.toml
84+
85+
- repo: local
86+
hooks:
87+
- id: update-changelog # Update changelog, section Unreleased
88+
name: update changelog
89+
entry: bash -c 'cz changelog > /dev/null'
90+
language: system
91+
pass_filenames: false

.pre-commit-hooks.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
- id: update-changelog
3+
name: Update changelog (section Unreleased)
4+
entry: 'cz changelog > /dev/null'
5+
language: system
6+
pass_filenames: false
7+
description: Updates changelog - section Unreleased
8+
additional_dependencies:
9+
- czespressif

CHANGELOG.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# CHANGELOG
2+
3+
> All notable changes to this project are documented in this file.
4+
> This list is not exhaustive - only important changes, fixes, and new features in the code are reflected here.
5+
6+
<sub>The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
7+
</sub>
8+
9+
---
10+
11+
## Unreleased
12+
13+
### 🚨 Breaking changes
14+
15+
- This will trigger a major version bump *(Tomas Sebestik - 8b702d6)*
16+
17+
### 📖 Documentation
18+
19+
- **readme**: update GitHub badges, add pypi and compatible python *(Tomas Sebestik - 8b702d6)*
20+
21+
---
22+
23+
## v0.3.1 (2024-09-10)
24+
25+
---
26+
27+
## v0.3.0 (2024-09-10)
28+
29+
### ✨ New features
30+
31+
- add pre-commit hook for autoupdate CHANGELOG *(Tomas Sebestik - 8fd458b)*
32+
33+
### 🐛 Bug fixes
34+
35+
- **changelog**: fix custom header,title,footer, update defaults *(Tomas Sebestik - ed9b8f3)*
36+
- **template**: fixed Changelog template - displaying w/wo authors, commits *(Tomas Sebestik - f151532)*
37+
38+
### 📖 Documentation
39+
40+
- **readme**: update examples with comments *(Tomas Sebestik - 65464ef)*
41+
42+
---
43+
44+
## v0.2.6 (2024-09-09)
45+
46+
### ✨ New features
47+
48+
- **plugin**: add plugin, commit message questions and changelog template *(Tomas Sebestik - dac86eb)*
49+
50+
### 🐛 Bug fixes
51+
52+
- **changelog**: do not add changelog headers when "cz bump" *(Tomas Sebestik - 65631a9)*
53+
- **changelog**: update changelog builder to be compatible with mdformat linter *(Tomas Sebestik - e6ba7d8)*
54+
55+
### 📖 Documentation
56+
57+
- **readme**: add basic usage and configuration *(Tomas Sebestik - e713491)*
58+
59+
---
60+
61+
## v0.1.0 (2024-09-07)
62+
63+
### ✨ New features
64+
65+
- init commit, project basic structure (from template commitizen) *(Tomas Sebestik - 61c03ec)*
66+
67+
---
68+
69+
**[Espressif Systems CO LTD. (2024)](https://www.espressif.com/)**
70+
71+
- [Commitizen tools plugin with Espressif code style](https://www.github.com/espressif/cz-plugin-espressif)
72+
- [Espressif Coding Standards and Best Practices](https://www.github.com/espressif/standards)

Justfile

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,47 @@ default:
1111
exit:
1212
exit 0
1313

14-
# Activate virtual environment
15-
activate-venv:
16-
if [ -d "venv" ]; then source venv/bin/activate; else echo "Virtual environment not found. Please create it first."; fi
14+
build-install:
15+
pip uninstall -y czespressif
16+
python -m build
17+
pip install .
18+
cz example
19+
pip list | grep czespressif
20+
21+
install:
22+
pip uninstall -y czespressif
23+
pip install -e .
24+
cz example
25+
pip list | grep czespressif
26+
27+
venv39:
28+
/usr/bin/python3.9 -m venv venv
29+
. venv/bin/activate
30+
31+
venv310:
32+
/usr/bin/python3.10 -m venv venv
33+
. venv/bin/activate
34+
35+
venv311:
36+
/usr/bin/python3.11 -m venv venv
37+
. venv/bin/activate
38+
39+
venv312:
40+
/usr/bin/python3.12 -m venv venv
41+
. venv/bin/activate
42+
43+
# Remove virtual environment
44+
remove-venv:
45+
rm -rf venv
46+
rm -rf .venv
1747

1848
# Reinstall development dependencies in virtual environment
1949
reinstall-venv:
2050
just activate-venv && pip install -e '.[dev]'
2151

2252
# Clean temporary and cache files
2353
clean-temps:
24-
rm -rf .mypy_cache/ .ruff_cache/ cz_plugin_espressif/cz_plugin_espressif.egg-info
54+
rm -rf .pytest_cache .mypy_cache .nox .ruff_cache .tox build dist
2555

2656
# Set up the environment: activate and reinstall
2757
setup-env:

0 commit comments

Comments
 (0)