Skip to content

Commit

Permalink
✨(ozi.render): add render_templates function
Browse files Browse the repository at this point in the history
Renders templates folder with CHANGELOG and release notes templates for semantic-release.

Signed-off-by: rjdbcm <[email protected]>
  • Loading branch information
rjdbcm committed Jun 20, 2024
1 parent 26427af commit bd1eb95
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ozi/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,20 @@ def render_ci_files_set_user(env: Environment, target: Path, ci_provider: str) -
return ci_user


def render_templates(env: Environment, target: Path) -> None:
"""Render the templates directory.
:param env: the OZI project file rendering environment
:type env: jinja2.Environment
:param target: directory path to render the project
:type target: Path
"""
for i in ['.release_notes.md.j2', 'CHANGELOG.md.j2', 'parsed_commit_heading.j2']:
template = env.get_template(f'templates/{i}')
with open(target / 'templates' / i, encoding='UTF-8') as f:
f.write(template.render())


def render_project_files(env: Environment, target: Path, name: str) -> None:
"""Render the primary new project files(excluding CI).
Expand Down Expand Up @@ -206,3 +220,4 @@ def render_project_files(env: Environment, target: Path, name: str) -> None:
template = env.get_template('project.ozi.wrap.j2')
with open(target / 'subprojects' / 'ozi.wrap', 'w', encoding='UTF-8') as f:
f.write(template.render())
render_templates(env, target)

0 comments on commit bd1eb95

Please sign in to comment.