|
| 1 | +name: Python langchain-ampersend Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "py-langchain-ampersend-v*.*.*" |
| 7 | + - "py-langchain-ampersend-v*.*.*a*" |
| 8 | + - "py-langchain-ampersend-v*.*.*b*" |
| 9 | + - "py-langchain-ampersend-v*.*.*rc*" |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + id-token: write # Required for PyPI trusted publishing |
| 14 | + |
| 15 | +jobs: |
| 16 | + verify-version: |
| 17 | + name: "py-langchain-ampersend: verify version" |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v5 |
| 23 | + |
| 24 | + - name: Setup uv |
| 25 | + uses: astral-sh/setup-uv@v6 |
| 26 | + |
| 27 | + - name: Install Python 3.13 |
| 28 | + run: uv python install 3.13 |
| 29 | + |
| 30 | + - name: Extract version from tag |
| 31 | + id: tag |
| 32 | + run: | |
| 33 | + TAG=${GITHUB_REF#refs/tags/py-langchain-ampersend-v} |
| 34 | + echo "version=$TAG" >> $GITHUB_OUTPUT |
| 35 | + echo "Tagged version: $TAG" |
| 36 | +
|
| 37 | + - name: Read pyproject.toml version |
| 38 | + id: package |
| 39 | + run: | |
| 40 | + VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('python/langchain-ampersend/pyproject.toml', 'rb'))['project']['version'])") |
| 41 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 42 | + echo "Package version: $VERSION" |
| 43 | +
|
| 44 | + - name: Compare versions |
| 45 | + run: | |
| 46 | + if [ "${{ steps.tag.outputs.version }}" != "${{ steps.package.outputs.version }}" ]; then |
| 47 | + echo "ERROR: Tag version (${{ steps.tag.outputs.version }}) does not match pyproject.toml version (${{ steps.package.outputs.version }})" |
| 48 | + exit 1 |
| 49 | + fi |
| 50 | + echo "✓ Versions match: ${{ steps.tag.outputs.version }}" |
| 51 | +
|
| 52 | + publish: |
| 53 | + name: "py-langchain-ampersend: publish to PyPI" |
| 54 | + runs-on: ubuntu-latest |
| 55 | + needs: verify-version |
| 56 | + environment: |
| 57 | + name: pypi |
| 58 | + url: https://pypi.org/p/langchain-ampersend |
| 59 | + |
| 60 | + steps: |
| 61 | + - name: Checkout |
| 62 | + uses: actions/checkout@v5 |
| 63 | + |
| 64 | + - name: Setup uv |
| 65 | + uses: astral-sh/setup-uv@v6 |
| 66 | + |
| 67 | + - name: Install Python 3.13 |
| 68 | + run: uv python install 3.13 |
| 69 | + |
| 70 | + - name: Build package |
| 71 | + run: uv build --package langchain-ampersend |
| 72 | + |
| 73 | + - name: Publish to PyPI |
| 74 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 75 | + with: |
| 76 | + packages-dir: dist/ |
0 commit comments