-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace static version with dynamic placeholder in setup.py and add G…
…itHub Actions workflow for PyPI releases (#78) Co-authored-by: Saibo MBP <[email protected]>
- Loading branch information
1 parent
6055ac5
commit d3c8b11
Showing
2 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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="[email protected]", | ||
description="Extension of Transformers library for Context-Free Grammar Constrained Decoding with EBNF grammars", | ||
|