Registry changelogs as plain text
The registry shows a version's changelog as one paragraph, without Markdown or line breaks: a shared script turns the CHANGELOG.md section into 'Added: ...; ... Fixed: ...' for both the publish and the update workflows.
This commit is contained in:
@@ -15,15 +15,11 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
- name: Changelog for this version
|
||||
# comfy-cli sends COMFY_NODE_CHANGELOG as the version's changelog
|
||||
# (the registry's Updates section): the matching CHANGELOG.md section.
|
||||
# comfy-cli sends COMFY_NODE_CHANGELOG as the version's changelog (the
|
||||
# registry's Updates section), as plain text: the registry shows one paragraph.
|
||||
run: |
|
||||
version=$(sed -n 's/^version = "\(.*\)"/\1/p' pyproject.toml | head -n1)
|
||||
notes=$(awk -v v="$version" '
|
||||
$0 ~ "^## " v "( |$)" { on = 1; next }
|
||||
on && /^## / { exit }
|
||||
on { print }
|
||||
' CHANGELOG.md | sed -e '/./,$!d')
|
||||
notes=$(python3 .github/scripts/registry_changelog.py "$version")
|
||||
if [ -z "$notes" ]; then
|
||||
echo "::warning::No CHANGELOG.md section for $version"
|
||||
exit 0
|
||||
@@ -31,11 +27,11 @@ jobs:
|
||||
delimiter="EOF_$(date +%s%N)"
|
||||
{
|
||||
echo "COMFY_NODE_CHANGELOG<<$delimiter"
|
||||
printf '%s\n' "$notes"
|
||||
printf '%s
|
||||
' "$notes"
|
||||
echo "$delimiter"
|
||||
} >> "$GITHUB_ENV"
|
||||
echo "Changelog for $version:"
|
||||
printf '%s\n' "$notes"
|
||||
echo "Changelog for $version: $notes"
|
||||
- name: Publish Custom Node
|
||||
uses: Comfy-Org/publish-node-action@main
|
||||
with:
|
||||
|
||||
@@ -28,17 +28,10 @@ jobs:
|
||||
publisher = re.search(r'^PublisherId\s*=\s*"([^"]+)"', open("pyproject.toml").read(), re.M).group(1)
|
||||
node = re.search(r'^name\s*=\s*"([^"]+)"', open("pyproject.toml").read(), re.M).group(1)
|
||||
|
||||
sections, current = {}, None
|
||||
for line in open("CHANGELOG.md", encoding="utf-8").read().splitlines():
|
||||
m = re.match(r"^## (\d+\.\d+\.\d+)\b", line)
|
||||
if m:
|
||||
current = m.group(1)
|
||||
sections[current] = []
|
||||
elif line.startswith("## "):
|
||||
current = None
|
||||
elif current:
|
||||
sections[current].append(line)
|
||||
notes = {v: "\n".join(lines).strip() for v, lines in sections.items()}
|
||||
import subprocess
|
||||
# Plain text: the registry shows the changelog as one paragraph.
|
||||
notes = json.loads(subprocess.check_output(
|
||||
[sys.executable, ".github/scripts/registry_changelog.py", "--all"], text=True, encoding="utf-8"))
|
||||
|
||||
with urllib.request.urlopen(f"{API}/nodes/{node}/versions") as r:
|
||||
published = json.load(r)
|
||||
|
||||
Reference in New Issue
Block a user