forked from sony/model_optimization
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create new_publish_release.yml (#89)
* Create new_publish_release.yml * Create version.py * Update __init__.py * Update setup.cfg
- Loading branch information
1 parent
d73b4a7
commit e1f9f13
Showing
4 changed files
with
63 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,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 }} |
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
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 @@ | ||
__version__ = '0.0.0' # this updated on the fly in .github/workflows/ |
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,3 +1,3 @@ | ||
[metadata] | ||
description-file = README.md | ||
version = attr: model_compression_toolkit.__version__ | ||
version = attr: model_compression_toolkit.version.__version__ |