From b8d4c78900b11da6667eb2f998303d14bba99ef1 Mon Sep 17 00:00:00 2001 From: paulpaliychuk Date: Wed, 8 May 2024 14:30:31 -0400 Subject: [PATCH] chore: Bring back release workflow --- .fernignore | 1 + .github/workflows/ci.yml | 26 +----------------------- .github/workflows/release.yml | 38 +++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.fernignore b/.fernignore index b99e6c34..2b5b6a49 100644 --- a/.fernignore +++ b/.fernignore @@ -6,3 +6,4 @@ src/zep_cloud/langchain/ pyproject.toml poetry.lock README.md +.github diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da1ae459..85b84ac3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,28 +33,4 @@ jobs: - name: Install dependencies run: poetry install - name: Test - run: poetry run pytest . - - publish: - needs: [compile, test] - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') - runs-on: ubuntu-20.04 - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - name: Set up python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - name: Bootstrap poetry - run: | - curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 - - name: Install dependencies - run: poetry install - - name: Publish to pypi - run: | - poetry config repositories.remote https://upload.pypi.org/legacy/ - poetry --no-interaction -v publish --build --repository remote --username "$PYPI_USERNAME" --password "$PYPI_PASSWORD" - env: - PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} - PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: poetry run pytest . \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..f6788ca5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release to PyPI + +on: + push: + tags: [ 'v*.*.*' ] + +env: + POETRY_VERSION: "1.7.1" + +jobs: + release: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + environment: + name: release + url: https://pypi.org/p/zep-cloud + steps: + - uses: actions/checkout@v3 + - name: Install poetry + run: pipx install poetry==$POETRY_VERSION + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + cache: "poetry" + - name: Compare pyproject version with tag + run: | + TAG_VERSION=${GITHUB_REF#refs/tags/} + if [ "$TAG_VERSION" != "v$(poetry version --short)" ]; then + echo "Tag version $TAG_VERSION does not match the project version $(poetry version --short)" + exit 1 + fi + - name: Build project for distribution + run: poetry build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file