From ba73821ada4adb42c33ea18511ad19cb98804f4b Mon Sep 17 00:00:00 2001 From: Evaline Ju <69598118+evaline-ju@users.noreply.github.com> Date: Mon, 26 Jun 2023 17:30:26 -0600 Subject: [PATCH] :construction_worker: Add publish to pypi Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com> --- .github/workflows/publish-library.yml | 36 +++++++++++++++++++++++++++ tox.ini | 10 ++++++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/publish-library.yml diff --git a/.github/workflows/publish-library.yml b/.github/workflows/publish-library.yml new file mode 100644 index 00000000..ee94d5f3 --- /dev/null +++ b/.github/workflows/publish-library.yml @@ -0,0 +1,36 @@ +# Copyright The Caikit Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Publish + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + - name: Release + env: + FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + pip install tox + RELEASE_VERSION=${GITHUB_REF#refs/*/} + RELEASE_VERSION=${RELEASE_VERSION#v*} + sed -i "s/^version = .*/version = \"${RELEASE_VERSION}\"/" pyproject.toml + tox -e publish diff --git a/tox.ini b/tox.ini index d473b333..abf9c0ba 100644 --- a/tox.ini +++ b/tox.ini @@ -33,3 +33,13 @@ skip_install = True # Skip package install since fmt doesn't need to execute cod description = lint with pylint deps = pylint>=2.16.2,<3.0 commands = pylint caikit_nlp + +[testenv:publish] +description = publish wheel to pypi +deps = flit==3.8 +passenv = + FLIT_PASSWORD +setenv = + FLIT_USERNAME = __token__ +commands = flit publish +skip_install = True