From 997234115d3ad715ad2adb6b3a092193163a91f8 Mon Sep 17 00:00:00 2001 From: "Jason M. Gates" Date: Tue, 24 Oct 2023 10:16:50 -0600 Subject: [PATCH 1/2] chore: Update python-semantic-release config * Add commit types to automatically bump the minor or patch version numbers via a commit message. * Update commitizen configuration to allow the new commit types. --- .github/workflows/continuous-integration.yml | 3 ++- pyproject.toml | 27 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 4bdc318..c1d67fa 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -59,4 +59,5 @@ jobs: - name: Conventional Commits uses: taskmedia/action-conventional-commits@v1.1.3 with: - types: "build|chore|ci|docs|feat|fix|perf|style|refactor|test" + types: > + build|chore|ci|docs|feat|fix|minor|patch|perf|style|refactor|test diff --git a/pyproject.toml b/pyproject.toml index 4161bbd..e340f5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,14 @@ skips = ["**/test_*.py"] line-length = 79 +[tool.commitizen] +name = "cz_customize" + + +[tool.commitizen.customize] +schema_pattern = "(?s)(build|chore|ci|docs|feat|fix|minor|patch|perf|refactor|style|test|revert)(\\(\\S+\\))?!?:( [^\\n\\r]+)((\\n\\n.*)|(\\s*))?$" + + [tool.isort] profile = "black" line_length = 79 @@ -97,3 +105,22 @@ exclude_commit_patterns = [ [tool.semantic_release.commit_author] env = "GIT_COMMIT_AUTHOR" default = "semantic-release " + + +[tool.semantic_release.commit_parser_options] +allowed_tags = [ + "build", + "chore", + "ci", + "docs", + "feat", + "fix", + "minor", + "patch", + "perf", + "refactor", + "style", + "test", +] +minor_tags = ["feat", "minor"] +patch_tags = ["fix", "patch", "perf"] From a447eac820ac9cadf081f1fdfeda1c4d5027552c Mon Sep 17 00:00:00 2001 From: "Jason M. Gates" Date: Tue, 24 Oct 2023 09:40:06 -0600 Subject: [PATCH 2/2] patch: Add release notes template * Create a template to govern the generation of release notes by python-semantic-release. * Bump the patch version number to test that this works as expected. --- templates/.release_notes.md.j2 | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 templates/.release_notes.md.j2 diff --git a/templates/.release_notes.md.j2 b/templates/.release_notes.md.j2 new file mode 100644 index 0000000..df4effc --- /dev/null +++ b/templates/.release_notes.md.j2 @@ -0,0 +1,11 @@ +{% for type_, commits in release["elements"] | dictsort %} +### {{ type_ | capitalize if type_ != "ci" else "Continuous Integration" }} +{%- if type_ != "unknown" %} +{% for commit in commits -%} +{%- set summary = commit.message.rstrip().splitlines()[0] -%} +{%- set details = commit.message.rstrip().splitlines()[2:] -%} +* {{ summary }} ([`{{ commit.hexsha[:7] }}`]({{ commit.hexsha | commit_hash_url }})) +{% if details %} +{% for line in details %}{% if line.strip() %} {{ line }}{% endif %} +{% endfor %}{% endif -%} +{% endfor %}{% endif %}{% endfor %}