Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert changelog to Markdown (MyST) #671

Merged
merged 6 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/lsp-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ jobs:
python-version: "3.10"

- run: |

sudo apt update
sudo apt install pandoc

python --version
python -m pip install --upgrade pip
python -m pip install --upgrade tox bump2version towncrier docutils
python -m pip install --upgrade tox hatch towncrier docutils
name: Setup Environment

- run: |
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/vscode-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ jobs:
${{ runner.os }}-vscode-pip-deps

- run: |
sudo apt update
sudo apt install pandoc

python --version
python -m pip install --upgrade pip
python -m pip install --upgrade tox hatch towncrier docutils
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

```{include} ../lib/esbonio/CHANGES.md
:relative-images:
```
4 changes: 0 additions & 4 deletions docs/changelog.rst

This file was deleted.

1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"esbonio.tutorial",
"cli_help",
"collection_items",
"myst_parser",
]

autodoc_member_order = "groupwise"
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
sphinx
sphinx-design
furo
myst-parser
pytest_lsp
-e lib/esbonio
-e lib/esbonio-extensions[tutorial]
610 changes: 610 additions & 0 deletions lib/esbonio/CHANGES.md

Large diffs are not rendered by default.

779 changes: 0 additions & 779 deletions lib/esbonio/CHANGES.rst

This file was deleted.

8 changes: 4 additions & 4 deletions lib/esbonio/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ explicit_package_bases = true
check_untyped_defs = true

[tool.towncrier]
filename = "CHANGES.rst"
filename = "CHANGES.md"
directory = "changes/"
title_format = "v{version} - {project_date}"
issue_format = "`#{issue} <https://github.com/swyddfa/esbonio/issues/{issue}>`_"
underlines = ["-", "^", "\""]
title_format = "## v{version} - {project_date}"
issue_format = "[#{issue}](https://github.com/swyddfa/esbonio/issues/{issue})"
underlines = ["", "", ""]

type = [
{ name = "Breaking Changes", directory = "breaking", showcontent = true },
Expand Down
18 changes: 4 additions & 14 deletions scripts/make_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import re
import subprocess
import sys
import tempfile
from datetime import datetime
from typing import Dict
from typing import Optional
Expand Down Expand Up @@ -188,7 +187,7 @@ def generate_changelog(component: Component, version: str):
"""Generate the changelog for the release."""

changes = pathlib.Path(component["src"]) / "changes"
if IS_RELEASE and len(list(changes.glob("*.rst"))) == 0:
if IS_RELEASE and len(list(changes.glob("*.md"))) == 0:
print("No changes detected, aborting")
sys.exit(1)

Expand All @@ -201,7 +200,7 @@ def generate_changelog(component: Component, version: str):
print("Unable to get changelog!")
sys.exit(1)

draft_file = pathlib.Path(tempfile.gettempdir()) / "changelog.rst"
draft_file = pathlib.Path(component["src"]) / ".changes.html"
draft_file.write_text(draft)

with Output(STEP_SUMMARY) as summary:
Expand All @@ -210,22 +209,13 @@ def generate_changelog(component: Component, version: str):
if not IS_RELEASE:
return

# Release notes for github
run(
"rst2html.py",
"--template=changes/github-template.html",
str(draft_file),
".changes.html",
cwd=component["src"],
)

# Release notes for changelog.
# Release notes for changelog
run("towncrier", "build", "--yes", f"--version={version}", cwd=component["src"])

# Needed for VSCode marketplace
if component["name"] == "vscode":
run(
*["pandoc", "CHANGES.rst", "-f", "rst", "-t", "gfm", "-o", "CHANGELOG.md"],
*["cp", "CHANGES.md", "CHANGELOG.md"],
cwd=component["src"],
)

Expand Down