From f394f20fac4f3f7896fc9d1c33b91558fc218409 Mon Sep 17 00:00:00 2001 From: James Kwon <96548424+hongil0316@users.noreply.github.com> Date: Wed, 1 May 2024 20:56:40 -0400 Subject: [PATCH] Update publish_package.yml --- .github/workflows/publish_package.yml | 33 +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index d65a6c9..0cbb257 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -5,17 +5,32 @@ on: types: [ created ] jobs: - pypi-publish: - name: Upload release to PyPI + build-n-publish: + name: Build and publish Python distributions to PyPI runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/project/comfy-cli/ - permissions: - id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - # retrieve your distributions here - - name: pypi-publish + - 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/gh-action-pypi-publish@v1.8.14