diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml new file mode 100644 index 0000000..e7a253a --- /dev/null +++ b/.github/workflows/prerelease.yml @@ -0,0 +1,45 @@ +name: Pre-release TypedUnits + +on: + push: + branches: + - main + +permissions: + contents: read + +jobs: + deploy: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build auditwheel patchelf + + - name: Build package + run: python -m build + env: + TypedUnits_RELEASE_VERSION: "$(python _version.py).dev$(date "+%Y%m%d%H%M%S")" + + - name: Repair Wheel + run: | + auditwheel repair --plat manylinux2014_x86_64 dist/*.whl + rm dist/*.whl + mv wheelhouse/* dist/ + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + repository-url: https://test.pypi.org/legacy/ + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..985ab7a --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +recursive-include . *pyx +include requirements.txt +include _version.py \ No newline at end of file diff --git a/_version.py b/_version.py new file mode 100644 index 0000000..b7e3eea --- /dev/null +++ b/_version.py @@ -0,0 +1,4 @@ +__version__ = '0.0.1' + +if __name__ == '__main__': + print(__version__) diff --git a/setup.py b/setup.py index 1256848..c4265d2 100644 --- a/setup.py +++ b/setup.py @@ -12,14 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import setuptools from Cython.Build import cythonize requirements = open('requirements.txt', 'r').readlines() + +_VERSION_KEY = 'TypedUnits_RELEASE_VERSION' +__version__ = os.environ.get(_VERSION_KEY, '') +if not __version__: + # Local build + import _version + + __version__ = _version.__version__ + '.dev' + + setuptools.setup( - name="tunits", - version="0.0.1", + name="typedunits", + version=__version__, packages=['tunits.proto', 'tunits.core', 'tunits'], include_package_data=True, ext_modules=cythonize(