Publish and Update Formula #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish and Update Formula | |
on: | |
release: | |
types: [ created ] | |
jobs: | |
build-n-publish: | |
name: Build and publish Python distributions to PyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install build dependencies | |
run: python -m pip install --upgrade pip build | |
- 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 toml; pyproj = toml.load('pyproject.toml'); pyproj['project']['version'] = '${{ env.VERSION }}'; toml.dump(pyproj, open('pyproject.toml', 'w'))" | |
- name: Build distribution | |
run: python -m build --sdist --wheel --outdir dist/ | |
- name: Publish distribution to PyPI | |
uses: pypa/[email protected] | |
update-homebrew-formula: | |
needs: build-n-publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Homebrew repo | |
uses: actions/checkout@v3 | |
with: | |
repository: Comfy-Org/homebrew-comfy-cli | |
path: homebrew-comfy-cli | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Create virtual environment and update formula | |
run: | | |
python3 -m venv venv | |
source venv/bin/activate | |
pip install comfy-cli homebrew-pypi-poet | |
poet -f comfy-cli > Formula/comfy-cli.rb # Directly overwrite the existing file | |
- name: Commit and push changes | |
run: | | |
cd homebrew-comfy-cli | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add Formula/comfy-cli.rb | |
git commit -m "Update comfy-cli formula" | |
git push |