Spaces:
Running
Running
| name: Chroma Release Python Client | |
| on: | |
| push: | |
| tags: | |
| - '[0-9]+.[0-9]+.[0-9]+' # Match tags in the form X.Y.Z | |
| branches: | |
| - main | |
| - hammad/thin_client | |
| jobs: | |
| check_tag: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag_matches: ${{ steps.check-tag.outputs.tag_matches }} | |
| steps: | |
| - name: Check Tag | |
| id: check-tag | |
| run: | | |
| if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "tag_matches=true" >> $GITHUB_OUTPUT | |
| fi | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| needs: check_tag | |
| if: needs.check_tag.outputs.tag_matches == 'true' | |
| permissions: write-all | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install Client Dev Dependencies | |
| run: python -m pip install -r ./clients/python/requirements.txt && python -m pip install -r ./clients/python/requirements_dev.txt | |
| - name: Build Client | |
| run: ./clients/python/build_python_thin_client.sh | |
| - name: Install setuptools_scm | |
| run: python -m pip install setuptools_scm | |
| - name: Get Release Version | |
| id: version | |
| run: echo "version=$(python -m setuptools_scm)" >> $GITHUB_OUTPUT | |
| - name: Get current date | |
| id: builddate | |
| run: echo "builddate=$(date +'%Y-%m-%dT%H:%M')" >> $GITHUB_OUTPUT | |
| - name: Publish to Test PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.TEST_PYPI_PYTHON_CLIENT_PUBLISH_KEY }} | |
| repository-url: https://test.pypi.org/legacy/ | |
| - name: Publish to PyPI | |
| if: startsWith(github.ref, 'refs/tags') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_PYTHON_CLIENT_PUBLISH_KEY }} | |