fix(release): sync Python SDK package.json version to 0.8.0 #36
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: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| python_only: | |
| description: "Skip npm release steps and publish only the current Python SDK version" | |
| required: false | |
| type: boolean | |
| default: false | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| release: | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Determine release mode | |
| id: mode | |
| run: echo "python_only=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.python_only == 'true' || 'false' }}" >> "$GITHUB_OUTPUT" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v5 | |
| with: | |
| version: 9.15.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "22" | |
| cache: "pnpm" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Verify release candidates | |
| if: steps.mode.outputs.python_only != 'true' | |
| run: pnpm release:verify | |
| - name: Create Release Pull Request or Publish | |
| id: changesets | |
| if: steps.mode.outputs.python_only != 'true' | |
| uses: changesets/action@v1 | |
| with: | |
| publish: pnpm release | |
| version: pnpm version-packages | |
| title: "chore(release): version packages" | |
| commit: "chore(release): version packages" | |
| createGithubReleases: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_CONFIG_PROVENANCE: "true" | |
| - name: Verify npm publication | |
| if: steps.changesets.outputs.published == 'true' | |
| env: | |
| PUBLISHED_NPM_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }} | |
| run: node ./scripts/verify-published-releases.mjs npm | |
| # PyPI Publishing - runs after npm packages are published | |
| - name: Setup Python | |
| if: steps.changesets.outputs.published == 'true' || steps.mode.outputs.python_only == 'true' | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Python build tools | |
| if: steps.changesets.outputs.published == 'true' || steps.mode.outputs.python_only == 'true' | |
| working-directory: packages/python-sdk | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e .[dev] build twine | |
| - name: Build Python package | |
| if: steps.changesets.outputs.published == 'true' || steps.mode.outputs.python_only == 'true' | |
| working-directory: packages/python-sdk | |
| run: | | |
| python -m pytest | |
| python -m build | |
| twine check dist/* | |
| - name: Publish to PyPI | |
| if: steps.changesets.outputs.published == 'true' || steps.mode.outputs.python_only == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: packages/python-sdk/dist/ | |
| - name: Verify PyPI publication | |
| if: steps.changesets.outputs.published == 'true' || steps.mode.outputs.python_only == 'true' | |
| run: node ./scripts/verify-published-releases.mjs pypi |