From ce4517d81ea41ca56bd3b13d9ad5596d18b2ff43 Mon Sep 17 00:00:00 2001 From: cody Date: Tue, 5 Aug 2025 10:58:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=8E=A8=E9=80=81=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-pipeline.yml | 36 +++++++--------- .github/workflows/publish_node.yml | 63 ++++++++++++---------------- .github/workflows/validate.yml | 13 ------ pyproject.toml | 2 +- 4 files changed, 42 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/build-pipeline.yml b/.github/workflows/build-pipeline.yml index f17f829..0855235 100644 --- a/.github/workflows/build-pipeline.yml +++ b/.github/workflows/build-pipeline.yml @@ -1,42 +1,34 @@ -name: comfyui_sunxAI_facetools CI build +# GitHub CI build pipeline +name: {{ cookiecutter.project_slug }} CI build on: pull_request: - branches: [ master, main ] - push: - branches: [ main ] # 可选:推送 main 时也跑一遍 - + branches: + - master + - main jobs: build: - runs-on: ubuntu-latest - - strategy: - matrix: - python-version: [ "3.10", "3.12" ] - + runs-on: {% raw %} ${{ matrix.os }} {% endraw %} env: PYTHONIOENCODING: "utf8" + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["3.12"] steps: - - name: Checkout - uses: actions/checkout@v4 - + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} - + python-version: {% raw %} ${{ matrix.python-version }} {% endraw %} - name: Install dependencies run: | python -m pip install --upgrade pip - # 安装项目 + 开发依赖(依赖你的 pyproject 中的 optional-dependencies.dev) - pip install ".[dev]" - + pip install .[dev] - name: Run Linting run: | - ruff version ruff check . - - name: Run Tests run: | - pytest -q + pytest tests/ diff --git a/.github/workflows/publish_node.yml b/.github/workflows/publish_node.yml index 81e267e..6765d41 100644 --- a/.github/workflows/publish_node.yml +++ b/.github/workflows/publish_node.yml @@ -1,48 +1,39 @@ -name: Publish Comfy Node +name: 📦 Auto Tag + Publish to Comfy registry on: push: - branches: [ "main" ] + branches: + - main paths: - "pyproject.toml" - - "nodes.py" - - "**/*.py" - - ".github/workflows/publish_node.yml" - workflow_dispatch: + +permissions: + contents: write # 需要打 tag 权限 + issues: write jobs: - publish: + publish-node: + name: Publish Custom Node to registry runs-on: ubuntu-latest - - permissions: - contents: read - steps: - - name: Checkout + - name: ♻️ Check out code uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + - name: 🧪 Extract version from pyproject.toml + id: get_version + run: | + VERSION=$(grep '^version' pyproject.toml | head -n 1 | cut -d '"' -f2) + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + echo "::set-output name=version::$VERSION" + + - name: 🏷️ Create Git Tag + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git tag v${{ steps.get_version.outputs.version }} + git push origin v${{ steps.get_version.outputs.version }} + + - name: 📦 Publish Custom Node + uses: Comfy-Org/publish-node-action@main with: - python-version: "3.10" - - - name: Install comfy-cli - run: | - python -m pip install --upgrade pip - pip install "comfy-cli>=0.9.0" - - - name: Validate node - run: | - comfy node validate - - - name: Publish node - env: - COMFY_REGISTRY_ACCESS_TOKEN: ${{ secrets.REGISTRY_ACCESS_TOKEN }} - run: | - if [ -z "${COMFY_REGISTRY_ACCESS_TOKEN}" ]; then - echo "Missing secret: REGISTRY_ACCESS_TOKEN"; exit 1; - fi - # 大多数版本的 comfy-cli 会从 COMFY_REGISTRY_ACCESS_TOKEN 读取 Token - # 如果你的版本需要从标准输入读取,可以改为: - # echo "${COMFY_REGISTRY_ACCESS_TOKEN}" | comfy node publish - comfy node publish + personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml deleted file mode 100644 index 8d3b5d4..0000000 --- a/.github/workflows/validate.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Validate backwards compatibility - -on: - pull_request: - branches: - - master - - main - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - uses: comfy-org/node-diff@main diff --git a/pyproject.toml b/pyproject.toml index ad695fc..384c59e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "comfyui_sunxAI_facetools" -version = "0.0.5" # 每次发布务必递增 +version = "0.0.6" # 每次发布务必递增 description = "Face detection & restoration tools for ComfyUI by Sunx.ai" authors = [ { name = "Sunx.ai", email = "sunx.ai@hotmail.com" }