Skip to content

[feat] Add GitHub Actions workflow for automated building and publishing #7

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

Merged
merged 6 commits into from
Jun 1, 2025
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
19 changes: 0 additions & 19 deletions .github/workflows/publish.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/react-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: React Extension Build + Publish to Comfy Registry

on:
push:
branches: [ "main" ]
paths:
- 'pyproject.toml'

jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Comfy-Org' }}

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: |
cd ui
npm install

- name: Build React extension
run: |
cd ui
npm run build

- name: Publish Custom Node
uses: Comfy-Org/publish-node-action@main
with:
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
skip_checkout: 'true'
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules/
__pycache__/
# don't ignore dist otherwise the transpiled JS won't be shipped to people who download
# dist/
dist/
.DS_Store
.env
.env.local
Expand Down
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ A minimal template for creating React/TypeScript frontend extensions for ComfyUI

## Installation

### From ComfyUI Registry (Recommended)

The easiest way to install this extension is through the ComfyUI Manager:

1. Open ComfyUI and go to the Manager
2. Search for "React Extension Template"
3. Click Install

### Manual Installation

If you want to install directly from GitHub for development purposes:

```bash
# Go to your ComfyUI custom_nodes directory
cd ComfyUI/custom_nodes
Expand All @@ -33,6 +45,8 @@ npm run build
# Restart ComfyUI
```

⚠️ **Important**: When installing manually from GitHub, you **must** run `npm run build` in the `ui/` directory before the extension will work. The extension requires the compiled React code in the `dist/` folder to function properly in ComfyUI.

## Usage

This template includes a simple example extension that displays workflow node statistics. After installation:
Expand Down Expand Up @@ -84,7 +98,7 @@ For comprehensive documentation on all available APIs, see the [ComfyUI JavaScri
ComfyUI-React-Extension-Template/
├── .github/ # GitHub configurations
│ └── workflows/
│ └── publish.yml # Automatic publishing workflow
│ └── react-build.yml # Automatic build and publishing workflow
├── __init__.py # Python entry point for ComfyUI integration
├── pyproject.toml # Project metadata for ComfyUI Registry
├── dist/ # Built extension files (generated)
Expand Down Expand Up @@ -148,6 +162,7 @@ npm install -D @comfyorg/comfyui-frontend-types
[tool.comfy]
PublisherId = "your_publisher_id" # Your Registry publisher ID
DisplayName = "Your Extension Display Name"
includes = ["dist/"] # Include built React code (normally ignored by .gitignore)
```

3. Publish your extension:
Expand All @@ -166,9 +181,14 @@ This template includes a GitHub Actions workflow that automatically publishes to
3. Commit and push an update to pyproject.toml (e.g., increment the version number)
4. The GitHub Action will automatically run and publish your extension

The workflow configuration is already set up in `.github/workflows/publish.yml` and will trigger when:
- The `pyproject.toml` file is modified
- The changes are pushed to the `main` branch
The workflow configuration is set up in `.github/workflows/react-build.yml` and will trigger when:
- The `pyproject.toml` file is modified and pushed to the `main` branch

The workflow automatically:
1. Sets up Node.js environment
2. Installs dependencies (`npm install`)
3. Builds the React extension (`npm run build`)
4. Publishes the extension to the ComfyUI Registry

## Unit Testing

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ Repository = "https://github.com/Comfy-Org/ComfyUI-React-Extension-Template"
[tool.comfy]
PublisherId = "your_publisher_id" # Change this to your actual publisher ID
DisplayName = "ComfyUI React Extension Template"
Icon = ""
Icon = ""
includes = ["dist/"]