chore: bump version to 2.7.1 (#70) #12
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 to PyPI | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' # Trigger on version tags like v0.1.0, v1.0.0, etc. | |
| workflow_dispatch: | |
| inputs: | |
| skip_integration: | |
| description: 'Skip integration tests (emergency only)' | |
| required: false | |
| default: 'false' | |
| jobs: | |
| # Run full test suite before publishing | |
| test: | |
| name: Test Suite | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run unit tests | |
| run: pytest tests/unit/ -v --tb=short | |
| # Verify integration tests passed for this commit | |
| verify-integration: | |
| name: Verify Integration Tests | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.inputs.skip_integration != 'true' }} | |
| permissions: | |
| checks: read | |
| steps: | |
| - name: Verify CI passed for this commit | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const sha = context.sha; | |
| const { data: checkRuns } = await github.rest.checks.listForRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: sha, | |
| check_name: 'SDK Server Contract Tests', | |
| }); | |
| const latestRun = checkRuns.check_runs | |
| .filter(run => run.status === 'completed' && run.completed_at) | |
| .sort((a, b) => new Date(b.completed_at).getTime() - new Date(a.completed_at).getTime()) | |
| [0]; | |
| const passed = latestRun && latestRun.conclusion === 'success'; | |
| if (!passed) { | |
| core.setFailed( | |
| `Integration tests have not passed for commit ${sha}. ` + | |
| `Run the integration-tests workflow first, or use skip_integration=true for emergencies.` | |
| ); | |
| return; | |
| } | |
| core.info(`Integration tests passed for ${sha} (latest run: ${latestRun.conclusion})`); | |
| build-and-publish: | |
| needs: [test, verify-integration] | |
| if: always() && needs.test.result == 'success' && (needs.verify-integration.result == 'success' || needs.verify-integration.result == 'skipped') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # For creating release | |
| id-token: write # Required for trusted publishing | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Full history for changelog | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build twine | |
| - name: Extract version from tag | |
| id: get_version | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Publishing version: $VERSION" | |
| - name: Build package | |
| run: python -m build | |
| - name: Check package | |
| run: python -m twine check dist/* | |
| - name: Publish to PyPI | |
| id: pypi-publish | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| # Using trusted publishing - no password needed | |
| # Configure at https://pypi.org/manage/account/publishing/ | |
| skip-existing: true | |
| verbose: true | |
| - name: Create GitHub Release | |
| if: success() # Only create release if PyPI publish succeeded | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/* | |
| generate_release_notes: true | |
| body: | | |
| # CapiscIO SDK ${{ steps.get_version.outputs.VERSION }} | |
| ## Installation | |
| ```bash | |
| pip install capiscio-sdk==${{ steps.get_version.outputs.VERSION }} | |
| ``` | |
| Or upgrade: | |
| ```bash | |
| pip install --upgrade capiscio-sdk | |
| ``` | |
| ## What's Changed | |
| See [CHANGELOG.md](https://github.com/capiscio/capiscio-sdk-python/blob/main/CHANGELOG.md) for detailed changes. | |
| ## Documentation | |
| - [Getting Started](https://docs.capisc.io/sdk-python/getting-started/quickstart/) | |
| - [Configuration Guide](https://docs.capisc.io/sdk-python/guides/configuration/) | |
| - [API Reference](https://docs.capisc.io/sdk-python/api/) | |
| --- | |
| **Full Changelog**: https://github.com/capiscio/capiscio-sdk-python/compare/${{ github.event.before }}...${{ github.ref_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |