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: Publish Python SDK to PyPI | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| temp_version: | |
| description: 'Optional version override (ex: 0.1.0-test)' | |
| required: false | |
| default: '' | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # Required for trusted publishing to PyPI | |
| env: | |
| TEMP_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.temp_version || '' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Setup Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Override Python package version for testing | |
| if: env.TEMP_VERSION != '' | |
| run: | | |
| sed -i.bak "s/^version = \".*\"/version = \"$TEMP_VERSION\"/" pyproject.toml | |
| - name: Build Python package | |
| run: uv build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # Publish instrumentation manifest to GitHub Pages | |
| # This makes the manifest available at: https://use-tusk.github.io/drift-python-sdk/instrumentation-manifest.json | |
| publish-manifest: | |
| needs: [publish] | |
| if: github.event_name == 'release' # Only run on actual releases, not workflow_dispatch | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout source (tagged commit) | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Generate manifest | |
| run: | | |
| python scripts/generate_manifest.py --output /tmp/instrumentation-manifest.json | |
| cat /tmp/instrumentation-manifest.json | |
| - name: Checkout gh-pages branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: gh-pages | |
| - name: Update manifest and commit | |
| run: | | |
| cp /tmp/instrumentation-manifest.json ./instrumentation-manifest.json | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add instrumentation-manifest.json | |
| git commit -m "Update manifest for ${{ github.event.release.tag_name }}" || echo "No changes to commit" | |
| git push origin gh-pages |