Skip to content

Commit

Permalink
Create new_publish_release.yml (#89)
Browse files Browse the repository at this point in the history
* Create new_publish_release.yml

* Create version.py

* Update __init__.py

* Update setup.cfg
  • Loading branch information
reuvenperetz authored Jan 20, 2025
1 parent d73b4a7 commit e1f9f13
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/new_publish_release.yml
Original file line number Diff line number Diff line change
@@ -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 - <<END
from packaging.version import parse
if not parse("${{ inputs.version }}"):
exit(1)
END
- name: update version
shell: bash
run: |
echo "__version__ = '${{ inputs.version }}'" > 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 }}
1 change: 0 additions & 1 deletion model_compression_toolkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 1 addition & 0 deletions model_compression_toolkit/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.0.0' # this updated on the fly in .github/workflows/
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[metadata]
description-file = README.md
version = attr: model_compression_toolkit.__version__
version = attr: model_compression_toolkit.version.__version__

0 comments on commit e1f9f13

Please sign in to comment.