Merge pull request #44 from jacob-bd/release/0.14.11 #61
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*.*.*" | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up uv and Python | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "latest" | |
| python-version: "3.12" | |
| enable-cache: true | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Publishing version: $VERSION" | |
| - name: Verify tag matches pyproject.toml | |
| run: | | |
| PKG_VERSION=$(grep -oP '(?<=^version = ")[^"]+' pyproject.toml) | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then | |
| echo "ERROR: Tag v$TAG_VERSION does not match pyproject.toml version $PKG_VERSION" | |
| exit 1 | |
| fi | |
| echo "Version check passed: $PKG_VERSION" | |
| - name: Build package | |
| run: uv build | |
| - name: Publish to PyPI (Trusted Publishing) | |
| run: uv publish --trusted-publishing always | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| VERSION="v${{ steps.version.outputs.version }}" | |
| PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD) | |
| { | |
| echo "## What's Changed" | |
| echo "" | |
| echo "| Date (UTC) | Commit Message | Link |" | |
| echo "|------------|----------------|------|" | |
| git log --date=iso-strict --pretty=format:"| %ad | %s | [\`%h\`](https://github.com/${{ github.repository }}/commit/%H) |" $PREVIOUS_TAG..HEAD | tac | |
| echo "" | |
| echo "" | |
| echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$PREVIOUS_TAG...$VERSION" | |
| } > changelog.md | |
| cat changelog.md | |
| echo "changelog<<EOF" >> $GITHUB_OUTPUT | |
| cat changelog.md >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: ${{ github.ref_name }} | |
| body: ${{ steps.changelog.outputs.changelog }} | |
| files: | | |
| dist/*.whl | |
| dist/*.tar.gz | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build MCPB extension | |
| run: python3 scripts/build_mcpb.py | |
| - name: Upload MCPB to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: perplexity-web-mcp-*.mcpb |