From e1d61fae08fa7e5f09a3412a323c0be05d8d8589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20B=C3=B6bel?= Date: Mon, 9 Mar 2026 23:11:04 +0100 Subject: [PATCH] add publishing to yaml --- .github/workflows/ci.yml | 73 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b66e454..a3503de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,9 +5,11 @@ on: branches: [main] pull_request: branches: [main] + release: + types: [published] jobs: - test-and-build: + test: runs-on: ubuntu-latest strategy: matrix: @@ -36,5 +38,70 @@ jobs: - name: Run tests run: uv run pytest tests/ - - name: Build wheel - run: uvx maturin build --release + build-wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + needs: test + if: github.event_name == 'release' + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + args: --release --out dist --interpreter 3.10 3.11 3.12 3.13 + manylinux: auto + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-${{ matrix.os }} + path: dist/ + + build-sdist: + name: Build source distribution + runs-on: ubuntu-latest + needs: test + if: github.event_name == 'release' + + steps: + - uses: actions/checkout@v4 + + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: sdist + path: dist/ + + pypi-publish: + name: Publish to PyPI + runs-on: ubuntu-latest + needs: [build-wheels, build-sdist] + if: github.event_name == 'release' + permissions: + id-token: write + environment: + name: pypi + url: https://pypi.org/project/pyhandlebars + + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: dist/ + merge-multiple: true + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/