initial release of notchpay v0.1.0 – full-featured unofficial Python SDK #1
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 and Publish | |
| on: | |
| push: | |
| branches: | |
| - "releases/**" | |
| env: | |
| PYTHON_VERSION: "3.9" | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract version from branch name | |
| run: | | |
| BRANCH_NAME="${GITHUB_REF#refs/heads/}" | |
| VERSION="${BRANCH_NAME#releases/}" | |
| echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "Branch version: $VERSION" | |
| - name: Extract version from pyproject.toml | |
| run: | | |
| TOML_VERSION=$(grep -E '^version = ' pyproject.toml | sed -E 's/version = "(.*)"/\1/') | |
| echo "TOML_VERSION=$TOML_VERSION" >> $GITHUB_ENV | |
| echo "TOML version: $TOML_VERSION" | |
| - name: Extract version from __init__.py | |
| run: | | |
| INIT_VERSION=$(grep -E '^__version__ = ' src/notchpay/__init__.py | sed -E 's/__version__ = "(.*)"/\1/') | |
| echo "INIT_VERSION=$INIT_VERSION" >> $GITHUB_ENV | |
| echo "__init__.py version: $INIT_VERSION" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| run: uv python install | |
| - name: Verify versions match | |
| run: | | |
| if [ "${{ env.TOML_VERSION }}" != "${{ env.PACKAGE_VERSION }}" ]; then | |
| echo "❌ Version mismatch: branch=${{ env.PACKAGE_VERSION }}, pyproject.toml=${{ env.TOML_VERSION }}" | |
| exit 1 | |
| fi | |
| if [ "${{ env.INIT_VERSION }}" != "${{ env.PACKAGE_VERSION }}" ]; then | |
| echo "❌ Version mismatch: branch=${{ env.PACKAGE_VERSION }}, __init__.py=${{ env.INIT_VERSION }}" | |
| exit 1 | |
| fi | |
| echo "✅ All versions match: ${{ env.PACKAGE_VERSION }}" | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev | |
| - name: Build package | |
| run: uv build | |
| - name: Upload wheel artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheel-package | |
| path: dist/*.whl | |
| - name: Upload source distribution artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: source-distribution | |
| path: dist/*.tar.gz | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/heads/releases/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| dist/*.whl | |
| dist/*.tar.gz | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| name: "Release v${{ env.PACKAGE_VERSION }}" | |
| body: | | |
| ## 🚀 Release v${{ env.PACKAGE_VERSION }} | |
| ### 📝 Latest Changes | |
| ${{ github.event.head_commit.message }} | |
| ### 📦 Installation | |
| ```bash | |
| pip install notchpay==${{ env.PACKAGE_VERSION }} | |
| ``` | |
| ### 🔗 Links | |
| - [Documentation](https://developer.notchpay.co/sdks/python) | |
| - [PyPI Package](https://pypi.org/project/notchpay/${{ env.PACKAGE_VERSION }}/) | |
| - [Changelog](https://github.com/${{ github.repository }}/blob/master/CHANGELOG.md) | |
| tag_name: "v${{ env.PACKAGE_VERSION }}" | |
| draft: false | |
| prerelease: false | |
| - name: Publish to PyPI | |
| if: startsWith(github.ref, 'refs/heads/releases/') | |
| env: | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
| run: uv publish --token $UV_PUBLISH_TOKEN | |
| - name: Delete release branch | |
| if: startsWith(github.ref, 'refs/heads/releases/') | |
| run: | | |
| BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
| git push origin --delete $BRANCH_NAME |