Release 2.5.3 #117
Workflow file for this run
This file contains hidden or 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
| name: Release | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| python-version: | |
| description: "Python version to use" | |
| default: "3.12" | |
| required: false | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| build-core: | |
| name: Build & Test Core SDK | |
| if: (github.event.pull_request.merged && startsWith(github.head_ref, 'release-')) || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| environment: ci | |
| outputs: | |
| version: ${{ steps.get_version.outputs.version }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install uv and set the python version | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ github.event.inputs.python-version || '3.12' }} | |
| - name: Sync environment & install dev extras | |
| run: | | |
| uv sync --all-packages --all-extras --dev --all-groups | |
| - name: Build core distributions | |
| run: | | |
| uv build -o dist | |
| - name: Extract package version | |
| id: get_version | |
| run: | | |
| python - <<'PY' | |
| import re, os, pathlib, sys | |
| version_file = pathlib.Path('getstream') / 'version.py' | |
| content = version_file.read_text() | |
| match = re.search(r"VERSION\s*=\s*['\"]([^'\"]+)['\"]", content) | |
| if not match: | |
| sys.exit('Could not find VERSION in getstream/version.py') | |
| version = match.group(1) | |
| with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: | |
| fh.write(f'version={version}\n') | |
| PY | |
| - name: Create release on GitHub | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ steps.get_version.outputs.version }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| generateReleaseNotes: true | |
| - name: Publish core to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| uv pip install --upgrade twine | |
| for FILE in dist/getstream*.whl; do | |
| BASENAME=$(basename "$FILE") | |
| PACKAGE_NAME=${BASENAME%%-*} | |
| VERSION=$(echo "$BASENAME" | cut -d'-' -f2) # 1.5.0a2 etc. | |
| echo "Checking if $PACKAGE_NAME version $VERSION exists on PyPI..." | |
| if pip index versions --pre "$PACKAGE_NAME" | grep -q "$VERSION"; then | |
| echo "Version $VERSION already exists for $PACKAGE_NAME – skipping upload." | |
| else | |
| echo "Uploading $BASENAME to PyPI." | |
| twine upload "$FILE" | |
| fi | |
| done | |
| - name: Install core from using uv | |
| run: | | |
| uv pip install "getstream==${{ steps.get_version.outputs.version }}" | |
| - name: Run core tests against PyPI artifact | |
| env: | |
| STREAM_BASE_URL: ${{ vars.STREAM_BASE_URL }} | |
| STREAM_API_KEY: ${{ vars.STREAM_API_KEY }} | |
| STREAM_API_SECRET: ${{ secrets.STREAM_API_SECRET }} | |
| run: | | |
| UV_NO_SOURCES=1 uv run pytest --ignore=getstream/plugins |