Files
StableLlama-ComfyUI-basic_d…/.github/workflows/publish_node.yml
T
2026-08-27 22:29:57 +02:00

63 lines
2.1 KiB
YAML

name: 📦 Publish to Comfy registry
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "pyproject.toml"
permissions:
issues: write
jobs:
publish-node:
name: Publish Custom Node to registry
if: github.repository_owner == 'StableLlama' # prevent unwanted runs on forks
runs-on: ubuntu-latest
steps:
- name: ♻️ Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install comfy-cli
run: pip install comfy-cli
- name: Extract changelog section for this version
id: changelog
run: |
python - <<'EOF'
import pathlib
import re
pyproject = pathlib.Path("pyproject.toml").read_text(encoding="utf-8")
version = re.search(r'^\s*version\s*=\s*"([^"]+)"', pyproject, re.M).group(1)
changelog = pathlib.Path("CHANGELOG.md").read_text(encoding="utf-8")
# Match headings like "## [1.7.0] - 2026-08-27", "## 1.7.0" or "## v1.7.0".
heading = re.compile(rf"^##\s+\[?v?{re.escape(version)}\]?\s*(?:-\s*\d{{4}}-\d{{2}}-\d{{2}})?\s*$", re.M)
match = heading.search(changelog)
if match is None:
print(f"::notice::No CHANGELOG.md section found for v{version}; publishing without a changelog")
pathlib.Path("CHANGELOG_CURRENT.md").write_text("", encoding="utf-8")
else:
end = heading.search(changelog, match.end())
section = changelog[match.end():end.start() if end else None].strip()
pathlib.Path("CHANGELOG_CURRENT.md").write_text(section + "\n", encoding="utf-8")
EOF
- name: 📦 Publish Custom Node
run: |
if [ -s CHANGELOG_CURRENT.md ]; then
comfy --skip-prompt --no-enable-telemetry node publish \
--token "${{ secrets.REGISTRY_ACCESS_TOKEN }}" \
--changelog-file CHANGELOG_CURRENT.md
else
comfy --skip-prompt --no-enable-telemetry node publish \
--token "${{ secrets.REGISTRY_ACCESS_TOKEN }}"
fi