Skip to content

Commit

Permalink
feat(plugin): add plugin, commit message questions, changelog template (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
tomassebestik committed Sep 10, 2024
1 parent d8f208c commit f2fa815
Show file tree
Hide file tree
Showing 22 changed files with 1,104 additions and 104 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
jobs:
check-pre-commit:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -17,4 +19,4 @@ jobs:
- name: Run pre-commit
uses: pre-commit/[email protected]
env:
SKIP: pip-compile
SKIP: pip-compile,update-changelog
19 changes: 1 addition & 18 deletions .github/workflows/pypa-publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ on:
release:
types: [created]
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name to release'
required: false

jobs:
pypi-build-publish:
Expand All @@ -28,26 +24,13 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Get tag name from input or Git
id: get_tag
run: |
if [ "${{ github.event.inputs.tag_name }}" ]; then
echo "TAG=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
else
echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
fi
- name: Display tag
run: echo "Releasing version $TAG"

- name: Install dependencies
run: |-
python -m pip install --upgrade pip
pip install build
- name: Build package
run: |-
python -m build
run: python -m build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
/docs/_build/
*.egg-info/
__pycache__/
_version.py
TODO.md
10 changes: 9 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ repos:
additional_dependencies:
- mdformat-gfm # Support for GitHub Flavored Markdown (GFM), including tables, task lists, strikethroughs, and autolinks.
- mdformat-ruff # Formats Python code blocks in Markdown files according to the `ruff` linter's style.
- mdformat-simple-breaks # Ensures that single line breaks in Markdown are converted to `<br>` t
- mdformat-simple-breaks # Ensures that single line breaks in Markdown are converted to `<br>`

- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
Expand All @@ -81,3 +81,11 @@ repos:
language: system
pass_filenames: false
files: requirements.txt|pyproject.toml

- repo: local
hooks:
- id: update-changelog # Update changelog, section Unreleased
name: update changelog
entry: bash -c 'cz changelog > /dev/null'
language: system
pass_filenames: false
9 changes: 9 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- id: update-changelog
name: Update changelog (section Unreleased)
entry: 'cz changelog > /dev/null'
language: system
pass_filenames: false
description: Updates changelog - section Unreleased
additional_dependencies:
- czespressif
72 changes: 72 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# CHANGELOG

> All notable changes to this project are documented in this file.
> This list is not exhaustive - only important changes, fixes, and new features in the code are reflected here.
<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/)
</sub>

---

## Unreleased

### 🚨 Breaking changes

- This will trigger a major version bump *(Tomas Sebestik - 8b702d6)*

### 📖 Documentation

- **readme**: update GitHub badges, add pypi and compatible python *(Tomas Sebestik - 8b702d6)*

---

## v0.3.1 (2024-09-10)

---

## v0.3.0 (2024-09-10)

### ✨ New features

- add pre-commit hook for autoupdate CHANGELOG *(Tomas Sebestik - 8fd458b)*

### 🐛 Bug fixes

- **changelog**: fix custom header,title,footer, update defaults *(Tomas Sebestik - ed9b8f3)*
- **template**: fixed Changelog template - displaying w/wo authors, commits *(Tomas Sebestik - f151532)*

### 📖 Documentation

- **readme**: update examples with comments *(Tomas Sebestik - 65464ef)*

---

## v0.2.6 (2024-09-09)

### ✨ New features

- **plugin**: add plugin, commit message questions and changelog template *(Tomas Sebestik - dac86eb)*

### 🐛 Bug fixes

- **changelog**: do not add changelog headers when "cz bump" *(Tomas Sebestik - 65631a9)*
- **changelog**: update changelog builder to be compatible with mdformat linter *(Tomas Sebestik - e6ba7d8)*

### 📖 Documentation

- **readme**: add basic usage and configuration *(Tomas Sebestik - e713491)*

---

## v0.1.0 (2024-09-07)

### ✨ New features

- init commit, project basic structure (from template commitizen) *(Tomas Sebestik - 61c03ec)*

---

**[Espressif Systems CO LTD. (2024)](https://www.espressif.com/)**

- [Commitizen tools plugin with Espressif code style](https://www.github.com/espressif/cz-plugin-espressif)
- [Espressif Coding Standards and Best Practices](https://www.github.com/espressif/standards)
38 changes: 34 additions & 4 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,47 @@ default:
exit:
exit 0

# Activate virtual environment
activate-venv:
if [ -d "venv" ]; then source venv/bin/activate; else echo "Virtual environment not found. Please create it first."; fi
build-install:
pip uninstall -y czespressif
python -m build
pip install .
cz example
pip list | grep czespressif

install:
pip uninstall -y czespressif
pip install -e .
cz example
pip list | grep czespressif

venv39:
/usr/bin/python3.9 -m venv venv
. venv/bin/activate

venv310:
/usr/bin/python3.10 -m venv venv
. venv/bin/activate

venv311:
/usr/bin/python3.11 -m venv venv
. venv/bin/activate

venv312:
/usr/bin/python3.12 -m venv venv
. venv/bin/activate

# Remove virtual environment
remove-venv:
rm -rf venv
rm -rf .venv

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

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

# Set up the environment: activate and reinstall
setup-env:
Expand Down
Loading

0 comments on commit f2fa815

Please sign in to comment.