Files
Artificial-Sweetener-Simple…/.github/workflows/release.yml
T

149 lines
4.0 KiB
YAML

name: release
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
inputs:
dry_run:
description: "Run semantic-release in dry-run mode without publishing"
required: false
default: "false"
type: choice
options:
- "true"
- "false"
permissions:
contents: write
jobs:
transformers-compatibility:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- label: comfy-v4-floor
version: "==4.50.3"
- label: latest-v4
version: "==4.57.6"
- label: v5-floor
version: "==5.0.0"
- label: latest-v5
version: ">=5,<6"
name: Transformers ${{ matrix.label }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install compatibility test dependencies
run: >-
python -m pip install pytest torch
"transformers${{ matrix.version }}"
- name: Verify GroundingDINO BERT compatibility
run: >-
python -m pytest -q
--noconftest
--rootdir=tests
--confcutdir=tests
tests/test_grounding_dino_bert_adapter.py
tests/test_grounding_dino_text_token_masks.py
release:
if: github.event_name != 'pull_request'
needs: transformers-compatibility
runs-on: ubuntu-latest
env:
SIMPLE_SYRUP_TEST_COMFY_CPU: "1"
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22.14.0
cache: npm
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install Node dependencies
run: npm ci
- name: Install ComfyUI host dependencies
shell: bash
run: |
set -euo pipefail
git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git "$RUNNER_TEMP/ComfyUI"
rsync -a --exclude=".git" "$RUNNER_TEMP/ComfyUI/" "$GITHUB_WORKSPACE/../.."/
pip install -r "$GITHUB_WORKSPACE/../../requirements.txt"
- name: Install Python dependencies
run: pip install -e . pytest pytest-xdist ruff mypy
- name: Verify Python formatting
run: ruff format --check .
- name: Verify Python lint
run: ruff check .
- name: Verify Python types
run: mypy --strict simple_syrup tests
- name: Verify Python tests
run: pytest -n auto -q -m "not external_artifact"
- name: Verify frontend
run: npm run check:web
- name: Release
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
set -euo pipefail
log_file="$(mktemp)"
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
npx semantic-release --dry-run --no-ci 2>&1 | tee "$log_file"
echo "released=false" >> "$GITHUB_OUTPUT"
else
npx semantic-release 2>&1 | tee "$log_file"
if grep -Eq "Published release |Created tag v[0-9]" "$log_file"; then
echo "released=true" >> "$GITHUB_OUTPUT"
else
echo "released=false" >> "$GITHUB_OUTPUT"
fi
fi
- name: Sync workspace to released commit
if: steps.release.outputs.released == 'true'
shell: bash
run: |
set -euo pipefail
git fetch origin main --tags
git checkout main
git reset --hard origin/main
- name: Publish Custom Node to Comfy Registry
if: steps.release.outputs.released == 'true'
uses: Comfy-Org/publish-node-action@main
with:
skip_checkout: true
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}