diff --git a/.github/workflows/new_publish_release.yml b/.github/workflows/new_publish_release.yml new file mode 100644 index 000000000..c855e4da6 --- /dev/null +++ b/.github/workflows/new_publish_release.yml @@ -0,0 +1,61 @@ +name: Upgraded Publish Release +on: + workflow_dispatch: + inputs: + version: + type: string + required: true + description: "Release version (e.g. 1.2.3). Corresponding tag (v1.2.3) should already exist." + to_testpypi: + type: boolean + required: true + default: true + description: "Publish to testpypi." + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: v${{ inputs.version }} + - name: Install Python 3 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Validate version + shell: bash + run: | + pip install --upgrade pip packaging + python3 - < model_compression_toolkit/version.py + echo "model_compression_toolkit/version.py content:" + cat model_compression_toolkit/version.py + + - name: Build wheel + shell: bash + run: | + pip install build twine + python -m build --wheel + + - name: Publish package pypi + if: inputs.to_testpypi == false + shell: bash + run: | + twine upload --repository pypi dist/* -u __token__ -p ${{ secrets.PYPI_API_KEY }} + + - name: Publish package testpypi + if: inputs.to_testpypi == true + shell: bash + run: | + twine upload --repository testpypi dist/* -u __token__ -p ${{ secrets.TEST_PYPI_API_KEY }} diff --git a/model_compression_toolkit/__init__.py b/model_compression_toolkit/__init__.py index 28ec7a4c1..daab76240 100644 --- a/model_compression_toolkit/__init__.py +++ b/model_compression_toolkit/__init__.py @@ -27,4 +27,3 @@ from model_compression_toolkit import pruning from model_compression_toolkit.trainable_infrastructure.keras.load_model import keras_load_quantized_model -__version__ = "2.2.0" diff --git a/model_compression_toolkit/version.py b/model_compression_toolkit/version.py new file mode 100644 index 000000000..bc53f9d21 --- /dev/null +++ b/model_compression_toolkit/version.py @@ -0,0 +1 @@ +__version__ = '0.0.0' # this updated on the fly in .github/workflows/ diff --git a/setup.cfg b/setup.cfg index c1b3e6aad..b40d89e41 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,3 @@ [metadata] description-file = README.md -version = attr: model_compression_toolkit.__version__ \ No newline at end of file +version = attr: model_compression_toolkit.version.__version__