-
Notifications
You must be signed in to change notification settings - Fork 22
106 lines (93 loc) · 3 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Release and Publish to Comfy registry
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'pyproject.toml'
jobs:
publish-node:
name: Release and Publish Custom Node to registry
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Get current version
id: current_version
run: |
echo "version=$(cat pyproject.toml | grep 'version =' | cut -d'=' -f2 | xargs)" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: check-tag
uses: actions/github-script@v7
with:
script: |
const tag = `v${{ steps.current_version.outputs.version }}`;
try {
await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag
});
return true
} catch (error) {
console.error(error)
return false
}
- name: Assert tag v${{ steps.current_version.outputs.version }} is not exist
run: |
if [ ${{ steps.check-tag.outputs.result }} == true ]; then
echo "Tag exists, skipping release"
exit 1
fi
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'pnpm'
- name: Build and Package
run: |
pnpm install
pnpm run build
tar -czf dist.tar.gz py/ web/ __init__.py LICENSE pyproject.toml
- name: Create release draft
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
dist.tar.gz
name: ${{ steps.current_version.outputs.version }}
tag_name: v${{ steps.current_version.outputs.version }}
draft: true
make_latest: true
- name: Prepare publish custom node to registry
run: |
find . -maxdepth 1 ! -name '.' ! -name 'dist.tar.gz' ! -name '.git' -exec rm -rf {} +
tar -xzf dist.tar.gz
rm -rf dist.tar.gz
# - name: Publish Custom Node
# uses: Comfy-Org/publish-node-action@main
# with:
# ## Add your own personal access token to your Github Repository secrets and reference it here.
# personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
#
# Publish Custom Node
# Copy from Comfy-Org/publish-node-action@main
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install comfy-cli
shell: bash
run: |
pip install comfy-cli
- name: Publish Node
shell: bash
run: |
comfy --skip-prompt --no-enable-telemetry env
comfy node publish --token ${{ secrets.REGISTRY_ACCESS_TOKEN }}