Skip to content

v1.5.1

v1.5.1 #94

Workflow file for this run

name: Publish and Update Formula
on:
release:
types: [ created ]
permissions:
contents: read
jobs:
build-n-publish-pypi:
name: Build and publish Python distributions to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install build and tomlkit dependencies
run: python -m pip install --upgrade pip build tomlkit
- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Update version in pyproject.toml
run: |
python -c "
import tomlkit
with open('pyproject.toml', 'r') as f:
content = tomlkit.load(f)
content['project']['version'] = '${{ env.VERSION }}'
with open('pyproject.toml', 'w') as f:
tomlkit.dump(content, f)
"
- name: Build distribution
run: python -m build --sdist --wheel --outdir dist/
# - name: Publish distribution to TestPyPI for Validation
# uses: pypa/[email protected]
# with:
# repository_url: https://test.pypi.org/legacy/
# - name: Clear pip cache
# run: pip cache purge
# - name: Install Comfy CLI from Test Pypi and Test
# run: |
# for i in {1..3}; do
# pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple comfy-cli==${{env.VERSION}} && break || sleep 5
# done
# comfy --help
- name: Publish distribution to Official PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
test-pip-installation:
name: Test Comfy CLI Installation via pip
needs: build-n-publish-pypi # This job runs after build-n-publish completes successfully
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install Comfy CLI via pip and Test
run: pip install comfy-cli==${{env.VERSION}}
- name: Test Comfy CLI Help
run: comfy --help
publish-homebrew-tap:
runs-on: macos-latest # Use macOS runner where Homebrew is pre-installed
needs: build-n-publish-pypi
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: 'Comfy-Org/homebrew-comfy-cli'
token: ${{ secrets.COMMITTER_TOKEN }}
path: 'homebrew-repo'
- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Set up Python environment
run: |
python3 -m venv venv
source venv/bin/activate
pip install homebrew-pypi-poet
for i in {1..3}; do
pip install comfy-cli==${{env.VERSION}} && break || sleep 5
done
- name: Generate Homebrew Formula
run: |
source venv/bin/activate
poet -f comfy-cli==$VERSION > comfy-cli.rb
- name: Move Formulas to Tap Directory
run: |
mv comfy-cli.rb homebrew-repo/Formula/
- name: Install Comfy CLI using Homebrew Formula
run: |
brew install --build-from-source --verbose ./homebrew-repo/Formula/comfy-cli.rb
comfy --help
brew uninstall comfy-cli
- name: Commit and Push Formula
run: |
cd homebrew-repo
git config user.name github-actions
git config user.email [email protected]
git add Formula/comfy-cli.rb
git commit -m "Update comfy-cli to latest and version ${VERSION}"
git push
env:
GIT_COMMITTER_NAME: github-actions
GIT_COMMITTER_EMAIL: [email protected]
GIT_AUTHOR_NAME: github-actions
GIT_AUTHOR_EMAIL: [email protected]
GITHUB_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
test-homebrew-installation:
name: Test Comfy CLI Installation via Homebrew
needs: publish-homebrew-tap # This job runs after publish-homebrew-tap completes successfully
runs-on: macos-latest
steps:
- name: Tap Comfy CLI Homebrew tap repository
run: brew tap Comfy-Org/comfy-cli
- name: Install comfy-cli latest via Homebrew
run: brew install comfy-org/comfy-cli/comfy-cli
- name: Test comfy-cli latest Help
run: comfy --help
- name: Uninstall comfy-cli latest
run: brew uninstall comfy-cli