From 1ca3a3005b2a7a2635f22e4037cee245d2d585b9 Mon Sep 17 00:00:00 2001 From: Marlon Saglia Date: Thu, 29 Aug 2024 12:24:45 +0200 Subject: [PATCH 1/2] feat: update version to 0.dev This commit updates the pyvespa version to 0.dev in the pyproject.toml and vespa/__init__.py files. The changes are made to ensure the project's version is accurately reflected across the codebase. --- .github/workflows/pyvespa.yml | 25 +++++++------------------ README.md | 6 +++++- pyproject.toml | 16 ++++++++-------- vespa/__init__.py | 2 +- 4 files changed, 21 insertions(+), 28 deletions(-) diff --git a/.github/workflows/pyvespa.yml b/.github/workflows/pyvespa.yml index cf289d5e..2c2ed211 100644 --- a/.github/workflows/pyvespa.yml +++ b/.github/workflows/pyvespa.yml @@ -22,15 +22,17 @@ jobs: - name: Set version from ref tag that triggered the workflow (strip prefix 'v' from tag) id: set_version run: | - echo "GITHUB_REF=$GITHUB_REF" + echo "GITHUB_REF=$GITHUB_REF" # strip prefix 'v' from version variable version=${GITHUB_REF#refs/tags/v} echo "version=$version" >> $GITHUB_OUTPUT - name: Update version + env: + VERSION: ${{ steps.set_version.outputs.version }} run: | - echo "Updating pyvespa version to ${{ steps.set_version.outputs.version }}" - python vespa/utils/update_version.py --version ${{ steps.set_version.outputs.version }} + echo "Updating pyvespa version to ${VERSION}" + python vespa/utils/update_version.py --version "${VERSION}" - name: Build run: | @@ -40,19 +42,6 @@ jobs: if: github.event_name == 'release' env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_PYVESPA }} #TODO: this must be added to secrets - run: python -m twine upload dist/* - - - name: Commit and PR - if: github.event_name == 'release' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NEW_BRANCH: "update-pyvespa-version-${{ steps.set_version.outputs.version }}" + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_PYVESPA }} run: | - git checkout -b "${NEW_BRANCH}" - git commit -a -m "Update pyvespa version to ${{ steps.set_version.outputs.version }}" - git push --set-upstream origin "${NEW_BRANCH}" - gh pr create -B master -H "${NEW_BRANCH}" \ - -t "Update pyvespa version to ${{ steps.set_version.outputs.version }}" \ - -b ":robot: This PR updates the pyvespa version to ${{ steps.set_version.outputs.version }}" - + python -m twine upload dist/* diff --git a/README.md b/README.md index 3abec2da..3a443e10 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,11 @@ [![Documentation Status](https://readthedocs.org/projects/pyvespa/badge/?version=latest)](https://pyvespa.readthedocs.io/en/latest/?badge=latest) - + +![GitHub Release](https://img.shields.io/github/v/release/vespa-engine/pyvespa) +![PyPI - Version](https://img.shields.io/pypi/v/pyvespa) +![PyPI - Downloads](https://img.shields.io/pypi/dm/pyvespa) + [pyvespa site / documentation](https://pyvespa.readthedocs.io/en/latest/index.html) diff --git a/pyproject.toml b/pyproject.toml index 10b35591..5e099fd8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "pyvespa" -version = "0.48.0" +version = "0.dev" description = "Python API for vespa.ai" readme = "README.md" keywords = ["vespa", "search engine", "data science"] @@ -61,13 +61,13 @@ docs = [ "ipykernel", ] feed = [ - "PyYAML", - "spacy", - "mmh3", - "requests<=2.31.0", - "html5lib", - "beautifulsoup4", - "markdownify", + "PyYAML", + "spacy", + "mmh3", + "requests<=2.31.0", + "html5lib", + "beautifulsoup4", + "markdownify", "tiktoken", "vespacli", ] diff --git a/vespa/__init__.py b/vespa/__init__.py index 0b7cca73..ad3cb188 100644 --- a/vespa/__init__.py +++ b/vespa/__init__.py @@ -1,3 +1,3 @@ # Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -__version__ = "0.48.0" +__version__ = "0.dev" From 30d282ad1f6cfc62236659eb4a19b6e783637e0c Mon Sep 17 00:00:00 2001 From: Marlon Saglia Date: Thu, 29 Aug 2024 12:43:27 +0200 Subject: [PATCH 2/2] feat(github-actions): enable automatic PyPi release on publish This commit enables automatic PyPi release for the 'pyvespa' library when a new release is published on GitHub. Previously, the release workflow was disabled, but this change now triggers the release process when a new release is published. The key changes are: - Modify the release trigger to listen for 'published' events instead of 'workflow_dispatch' - Add an environment variable 'RELEASE_REF' to ensure the version is available, even if the 'GITHUB_REF' variable is not set correctly - Update the version extraction logic to use the 'RELEASE_REF' variable instead of 'GITHUB_REF' --- .github/workflows/pyvespa.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pyvespa.yml b/.github/workflows/pyvespa.yml index 2c2ed211..bd3c0a09 100644 --- a/.github/workflows/pyvespa.yml +++ b/.github/workflows/pyvespa.yml @@ -1,13 +1,15 @@ name: pyvespa - Release and upload PyPI on: - workflow_dispatch: - # release: Disable auto-release until actions are approved - # types: [published] + release: + types: [published] jobs: update_version: runs-on: ubuntu-latest + env: + # Workaround to ensure that the version is available + RELEASE_REF: ${{ github.ref || format('{0}{1}', 'refs/tags/', github.event.release.tag_name) }} steps: - uses: actions/checkout@v4 @@ -22,9 +24,8 @@ jobs: - name: Set version from ref tag that triggered the workflow (strip prefix 'v' from tag) id: set_version run: | - echo "GITHUB_REF=$GITHUB_REF" # strip prefix 'v' from version variable - version=${GITHUB_REF#refs/tags/v} + version=${RELEASE_REF#refs/tags/v} echo "version=$version" >> $GITHUB_OUTPUT - name: Update version