diff --git a/.github/workflows/pipy_release.yml b/.github/workflows/pipy_release.yml new file mode 100644 index 0000000..929d9ce --- /dev/null +++ b/.github/workflows/pipy_release.yml @@ -0,0 +1,34 @@ +name: Publish Python 🐍 distributions 📦 to PyPI + +on: + push: + tags: + - '*' # Trigger on any tagging event + +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 # Updated to a specific version of the checkout action + with: + ref: main # Ensure it checks out the main branch + - name: Set up Python 3.8 + uses: actions/setup-python@v3 + with: + python-version: '3.8' + - name: Install setuptools and wheel + run: python -m pip install setuptools wheel + - name: Extract tag name + id: tag + run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3) + - name: Update version in setup.py + run: >- + sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py + - name: Build a binary wheel + run: >- + python setup.py sdist bdist_wheel + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/setup.py b/setup.py index 25a4f6d..cf08f8d 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,8 @@ from setuptools import setup, find_packages -from transformers_cfg import __version__ setup( name="transformers_cfg", - version=__version__, + version="{{VERSION_PLACEHOLDER}}", author="EPFL-dlab", author_email="saibo.geng@epfl.ch", description="Extension of Transformers library for Context-Free Grammar Constrained Decoding with EBNF grammars",