Skip to content

Commit 12a92a4

Browse files
authored
Update node publish workflow to only publish when the version is bumped.
1 parent 16c55fc commit 12a92a4

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

zh-CN/registry/publishing.mdx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,37 @@ See it here: https://registry.comfy.org/publisherId/your-node
119119
```bash
120120
name: Publish to Comfy registry
121121
on:
122-
workflow_dispatch:
123122
push:
124-
branches:
125-
- main
123+
branches: [main]
126124
paths:
127125
- "pyproject.toml"
126+
workflow_dispatch:
128127

129128
jobs:
130129
publish-node:
131-
name: Publish Custom Node to registry
132130
runs-on: ubuntu-latest
133131
steps:
134-
- name: Check out code
135-
uses: actions/checkout@v4
132+
- uses: actions/checkout@v4
133+
134+
- name: Detect version change
135+
id: version_check
136+
run: |
137+
set -e
138+
OLD_VERSION=$(git show HEAD^:pyproject.toml 2>/dev/null | grep '^version' | sed 's/.*"//' | sed 's/".*//')
139+
NEW_VERSION=$(grep '^version' pyproject.toml | sed 's/.*"//' | sed 's/".*//')
140+
echo "old=${OLD_VERSION}"
141+
echo "new=${NEW_VERSION}"
142+
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
143+
echo "changed=true" >> $GITHUB_OUTPUT
144+
else
145+
echo "changed=false" >> $GITHUB_OUTPUT
146+
fi
147+
136148
- name: Publish Custom Node
149+
if: steps.version_check.outputs.changed == 'true'
137150
uses: Comfy-Org/publish-node-action@main
138151
with:
139-
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }} ## Add your own personal access token to your Github Repository secrets and reference it here.
152+
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
140153
```
141154

142155
<Warning>

0 commit comments

Comments
 (0)