chore: release 1.0.1

chore: release 1.0.1
This commit is contained in:
dtomlinson91
2021-11-21 23:13:44 +00:00
committed by GitHub
6 changed files with 94 additions and 147 deletions

View File

@@ -4,12 +4,30 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.1](https://github.com/tembo-pages/tembo-core/commits/1.0.1) - 2021-11-21
<small>[Compare with v1.0.0](https://github.com/tembo-pages/tembo-core/compare/v1.0.1...v1.0.0)</small>
### Miscellaneous Tasks
<!-- insertion marker --> - Add changelog generation using git-cliff ([4c8d68](https://github.com/tembo-pages/tembo-core/commit/4c8d686abb82ade97680a3e8cdef267559282ff4))
## [1.0.0](https://github.com/tembo-pages/tembo-core/releases/tag/1.0.01.0.0) - 2021-11-21 - Prepare release 1.0.1 ([b077aa](https://github.com/tembo-pages/tembo-core/commit/b077aaaf6666e78507f6439fa2e10a34c55176e5))
<small>[Compare with first commit](https://github.com/tembo-pages/tembo-core/compare/fb7fec7ea619318b0e0830c0f9260335c0d4e173...1.0.0)</small> ## [1.0.0](https://github.com/tembo-pages/tembo-core/commits/v1.0.0) - 2021-11-21
### Documentation
- Update changelog ([26fe81](https://github.com/tembo-pages/tembo-core/commit/26fe8118649bbff109233a80130a7323539f256f))
### Features ### Features
- initial commit ([fb7fec7](https://github.com/tembo-pages/tembo-core/commit/fb7fec7ea619318b0e0830c0f9260335c0d4e173) by Daniel Tomlinson).
- Initial commit ([fb7fec](https://github.com/tembo-pages/tembo-core/commit/fb7fec7ea619318b0e0830c0f9260335c0d4e173))
### Miscellaneous Tasks
- Update duties.py ([562de6](https://github.com/tembo-pages/tembo-core/commit/562de606c4846ad37d32822260121892c353e7ca))
- Prepare release 1.0.0 ([eed47d](https://github.com/tembo-pages/tembo-core/commit/eed47d34b9a0b79f48b2fbe0ad77f43dc42f6027))
### Build
- Update panaetius to 2.3.3 ([e5d2b2](https://github.com/tembo-pages/tembo-core/commit/e5d2b28252b9d7962a8d49d4da37b9f9c4f6d514))

57
cliff.toml Normal file
View File

@@ -0,0 +1,57 @@
# configuration file for git-cliff (0.1.0)
[changelog]
# changelog header
header = """
# Changelog
All notable changes to this project will be documented in this file.\n
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
"""
# template for the changelog body
# https://tera.netlify.app/docs/#introduction
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}](https://github.com/tembo-pages/tembo-core/commits/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
{% if previous.version %}\
<small>[Compare with {{ previous.version }}](https://github.com/tembo-pages/tembo-core/compare/v{{ version }}...{{ previous.version }})</small>
{% endif %}\
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=6, end="") }}](https://github.com/tembo-pages/tembo-core/commit/{{ commit.id }}))\
{% endfor %}
{% endfor %}\n
"""
# remove the leading and trailing whitespaces from the template
trim = true
# changelog footer
footer = """
"""
[git]
# allow only conventional commits
# https://www.conventionalcommits.org
conventional_commits = true
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "Features"},
{ message = "^fix", group = "Bug Fixes"},
{ message = "^doc", group = "Documentation"},
{ message = "^perf", group = "Performance"},
{ message = "^refactor", group = "Refactor"},
{ message = "^style", group = "Styling"},
{ message = "^test", group = "Testing"},
{ message = "^chore\\(release\\): prepare for", skip = true},
{ message = "^chore", group = "Miscellaneous Tasks", skip = false},
{ body = ".*security", group = "Security"},
]
# filter out the commits that are not matched by commit parsers
filter_commits = false
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
# regex for skipping tags
skip_tags = "v0.1.0-beta.1"

152
duties.py
View File

@@ -322,99 +322,23 @@ def check_dependencies(ctx):
pty=True, pty=True,
) )
@duty
def _latest(lines: List[str], regex: Pattern) -> Optional[str]: def changelog(ctx, planned_release: Optional[str] = None):
for line in lines:
match = regex.search(line)
if match:
return match.groupdict()["version"]
return None
def _unreleased(versions, last_release):
for index, version in enumerate(versions):
if version.tag == last_release:
return versions[:index]
return versions
def update_changelog(
inplace_file: str,
marker: str,
version_regex: str,
commit_style: str,
planned_tag: str,
last_released: str,
) -> None:
""" """
Update the given changelog file in place. Generate a changelog with git-cliff.
Arguments:
inplace_file: The file to update in-place.
marker: The line after which to insert new contents.
version_regex: A regular expression to find currently documented versions in the file.
template_url: The URL to the Jinja template used to render contents.
commit_style: The style of commit messages to parse.
"""
from git_changelog.build import Changelog
from jinja2.sandbox import SandboxedEnvironment
env = SandboxedEnvironment(autoescape=False) Args:
template = env.from_string(changelog_template())
changelog = Changelog(".", style=commit_style)
if len(changelog.versions_list) == 1:
last_version = changelog.versions_list[0]
print(last_version.planned_tag)
if last_version.planned_tag is None:
planned_tag = planned_tag
last_version.tag = planned_tag
last_version.url += planned_tag
last_version.compare_url = last_version.compare_url.replace("HEAD", planned_tag)
with open(inplace_file, "r") as changelog_file:
lines = changelog_file.read().splitlines()
# last_released = _latest(lines, re.compile(version_regex))
last_released = last_released
print(last_released)
if last_released:
changelog.versions_list = _unreleased(changelog.versions_list, last_released)
rendered = template.render(changelog=changelog, inplace=True)
lines[lines.index(marker)] = rendered
with open(inplace_file, "w") as changelog_file: # noqa: WPS440
changelog_file.write("\n".join(lines).rstrip("\n") + "\n")
# @duty
def changelog(planned_tag, last_released):
"""
Update the changelog in-place with latest commits.
Arguments:
ctx: The context instance (passed automatically). ctx: The context instance (passed automatically).
planned_release (str, optional): The planned release version. Example: v1.0.2
""" """
# print( if planned_release is not None:
# ctx.run( changelog = ctx.run(["git", "cliff", "--tag", planned_release])
# update_changelog, else:
# kwargs={ changelog = ctx.run(["git", "cliff"])
# "inplace_file": "CHANGELOG.md",
# "marker": "<!-- insertion marker -->",
# "version_regex": r"^## \[v?(?P<version>[^\]]+)",
# "commit_style": "angular",
# },
# title="Updating changelog",
# pty=True,
# )
# )
update_changelog( changelog_file = pathlib.Path(".") / "CHANGELOG.md"
inplace_file="CHANGELOG.md", with changelog_file.open("w", encoding="utf-8") as changelog_contents:
marker="<!-- insertion marker -->", changelog_contents.write(changelog)
version_regex=r"^## \[v?(?P<version>[^\]]+)",
commit_style="angular",
planned_tag=planned_tag,
last_released=last_released
)
@@ -432,55 +356,3 @@ def rm_tree(directory: pathlib.Path):
else: else:
rm_tree(child) rm_tree(child)
directory.rmdir() directory.rmdir()
def changelog_template() -> str:
return """
{% if not inplace -%}
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
{% endif %}<!-- insertion marker -->
{% macro render_commit(commit) -%}
- {{ commit.style.subject|default(commit.subject) }} ([{{ commit.hash|truncate(7, True, '') }}]({{ commit.url }}) by {{ commit.author_name }}).
{%- if commit.text_refs.issues_not_in_subject %} References: {% for issue in commit.text_refs.issues_not_in_subject -%}
{% if issue.url %}[{{ issue.ref }}]({{ issue.url }}){%else %}{{ issue.ref }}{% endif %}{% if not loop.last %}, {% endif -%}
{%- endfor -%}{%- endif -%}
{%- endmacro -%}
{%- macro render_section(section) -%}
### {{ section.type or "Misc" }}
{% for commit in section.commits|sort(attribute='author_date',reverse=true)|unique(attribute='subject') -%}
{{ render_commit(commit) }}
{% endfor %}
{%- endmacro -%}
{%- macro render_version(version) -%}
{%- if version.tag or version.planned_tag -%}
## [{{ version.tag or version.planned_tag }}]({{ version.url }}){% if version.date %} - {{ version.date }}{% endif %}
<small>[Compare with {{ version.previous_version.tag|default("first commit") }}]({{ version.compare_url }})</small>
{%- else -%}
## Unrealeased
<small>[Compare with latest]({{ version.compare_url }})</small>
{%- endif %}
{% for type, section in version.sections_dict|dictsort -%}
{%- if type and type in changelog.style.DEFAULT_RENDER -%}
{{ render_section(section) }}
{% endif -%}
{%- endfor -%}
{%- endmacro -%}
{% for version in changelog.versions_list -%}
{{ render_version(version) }}
{%- endfor -%}
"""
if __name__ == "__main__":
changelog("1.0.1", "1.0.0")

View File

@@ -1,7 +1,7 @@
[tool.poetry] [tool.poetry]
name = "tembo" name = "tembo"
description = "A simple folder organiser for your work notes." description = "A simple folder organiser for your work notes."
version = "1.0.0" version = "1.0.1"
license = "ISC" license = "ISC"
authors = ["dtomlinson <dtomlinson@panaetius.co.uk>"] authors = ["dtomlinson <dtomlinson@panaetius.co.uk>"]
readme = "./README.md" readme = "./README.md"

View File

@@ -18,7 +18,7 @@ entry_points = \
setup_kwargs = { setup_kwargs = {
'name': 'tembo', 'name': 'tembo',
'version': '1.0.0', 'version': '1.0.1',
'description': 'A simple folder organiser for your work notes.', 'description': 'A simple folder organiser for your work notes.',
'long_description': '# Tembo\n\n<img\n src="https://raw.githubusercontent.com/tembo-pages/tembo-core/main/assets/tembo_logo.png"\n width="200px"\n/>\n\nA simple folder organiser for your work notes.\n\n![](https://img.shields.io/codecov/c/github/tembo-pages/tembo-core?style=flat-square)\n\n![Sonar Coverage](https://img.shields.io/sonar/coverage/tembo-pages_tembo-core?server=https%3A%2F%2Fsonarcloud.io&style=flat-square)\n![Sonar Tests](https://img.shields.io/sonar/tests/tembo-pages_tembo-core?compact_message&failed_label=failed&passed_label=passed&server=https%3A%2F%2Fsonarcloud.io&skipped_label=skipped&style=flat-square)\n![Sonar Tech Debt](https://img.shields.io/sonar/tech_debt/tembo-pages_tembo-core?server=https%3A%2F%2Fsonarcloud.io&style=flat-square)\n\n## config.yml\n\n```yaml\n# time tokens: https://strftime.org\ntembo:\n base_path: ~/tembo\n # template_path: ~/tembo/templates\n scopes:\n - name: scratchpad\n example: tembo new scratchpad\n path: "scratchpad/{d:%B_%Y}"\n filename: "{d:%B_%W}"\n extension: md\n template_filename: scratchpad.md.tpl\n - name: wtodo\n example: tembo new wtodo | directory is month_year, filename is month_week-of-year\n path: "wtodo/{d:%B_%Y}"\n filename: "week_{d:%W}"\n extension: todo\n template_filename: weekly.todo.tpl\n - name: meeting\n example: tembo new meeting $meeting_title\n path: "meetings/{d:%B_%y}"\n filename: "{d:%a_%d_%m_%y}-{input0}"\n extension: md\n template_filename: meeting.md.tpl\n - name: knowledge\n example: tembo new knowledge $project $filename\n path: "knowledge/{input0}"\n filename: "{input1}"\n extension: md\n template_filename: knowledge.md.tpl\n logging:\n level: INFO\n path: ~/tembo/.logs\n```\n\n## templates\n\n###\xa0knowledge\n\n```\n---\ncreated: {d:%d-%m-%Y}\n---\n\n# {input0} - {input1}.md\n```\n\n### meeting\n\n```\n---\ncreated: {d:%d-%m-%Y}\n---\n\n# {d:%A %d %B %Y} - {input0}\n\n## People\n\nHead:\n\nAttendees:\n\n## Actions\n\n\n## Notes\n\n```\n\n### scratchpad\n\n```\n---\ncreated: {d:%d-%m-%Y}\n---\n\n# Scratchpad - Week {d:%W} - {d:%B-%y}\n```\n\n### wtodo\n\n```\n---\ncreated: {d:%d-%m-%Y}\n---\n\nWeekly TODO | Week {d:%W} {d:%B}-{d:%Y}\n\nWork:\n\nDocumentation:\n```\n', 'long_description': '# Tembo\n\n<img\n src="https://raw.githubusercontent.com/tembo-pages/tembo-core/main/assets/tembo_logo.png"\n width="200px"\n/>\n\nA simple folder organiser for your work notes.\n\n![](https://img.shields.io/codecov/c/github/tembo-pages/tembo-core?style=flat-square)\n\n![Sonar Coverage](https://img.shields.io/sonar/coverage/tembo-pages_tembo-core?server=https%3A%2F%2Fsonarcloud.io&style=flat-square)\n![Sonar Tests](https://img.shields.io/sonar/tests/tembo-pages_tembo-core?compact_message&failed_label=failed&passed_label=passed&server=https%3A%2F%2Fsonarcloud.io&skipped_label=skipped&style=flat-square)\n![Sonar Tech Debt](https://img.shields.io/sonar/tech_debt/tembo-pages_tembo-core?server=https%3A%2F%2Fsonarcloud.io&style=flat-square)\n\n## config.yml\n\n```yaml\n# time tokens: https://strftime.org\ntembo:\n base_path: ~/tembo\n # template_path: ~/tembo/templates\n scopes:\n - name: scratchpad\n example: tembo new scratchpad\n path: "scratchpad/{d:%B_%Y}"\n filename: "{d:%B_%W}"\n extension: md\n template_filename: scratchpad.md.tpl\n - name: wtodo\n example: tembo new wtodo | directory is month_year, filename is month_week-of-year\n path: "wtodo/{d:%B_%Y}"\n filename: "week_{d:%W}"\n extension: todo\n template_filename: weekly.todo.tpl\n - name: meeting\n example: tembo new meeting $meeting_title\n path: "meetings/{d:%B_%y}"\n filename: "{d:%a_%d_%m_%y}-{input0}"\n extension: md\n template_filename: meeting.md.tpl\n - name: knowledge\n example: tembo new knowledge $project $filename\n path: "knowledge/{input0}"\n filename: "{input1}"\n extension: md\n template_filename: knowledge.md.tpl\n logging:\n level: INFO\n path: ~/tembo/.logs\n```\n\n## templates\n\n###\xa0knowledge\n\n```\n---\ncreated: {d:%d-%m-%Y}\n---\n\n# {input0} - {input1}.md\n```\n\n### meeting\n\n```\n---\ncreated: {d:%d-%m-%Y}\n---\n\n# {d:%A %d %B %Y} - {input0}\n\n## People\n\nHead:\n\nAttendees:\n\n## Actions\n\n\n## Notes\n\n```\n\n### scratchpad\n\n```\n---\ncreated: {d:%d-%m-%Y}\n---\n\n# Scratchpad - Week {d:%W} - {d:%B-%y}\n```\n\n### wtodo\n\n```\n---\ncreated: {d:%d-%m-%Y}\n---\n\nWeekly TODO | Week {d:%W} {d:%B}-{d:%Y}\n\nWork:\n\nDocumentation:\n```\n',
'author': 'dtomlinson', 'author': 'dtomlinson',

View File

@@ -1,3 +1,3 @@
"""Module containing the version of tembo.""" """Module containing the version of tembo."""
__version__ = "1.0.0" __version__ = "1.0.1"