108 lines
2.9 KiB
YAML
108 lines
2.9 KiB
YAML
name: release
|
|
|
|
on:
|
|
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:
|
|
release:
|
|
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
|
|
|
|
- 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 }}
|