v0.5.0 #6
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 | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| linux-wheels: | |
| name: Linux ${{ matrix.target }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [x86_64, aarch64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: --release --locked --out dist | |
| manylinux: auto | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-linux-${{ matrix.target }} | |
| path: dist | |
| macos-wheels: | |
| name: macOS ${{ matrix.target }} | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [x86_64, aarch64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: --release --locked --out dist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-macos-${{ matrix.target }} | |
| path: dist | |
| windows-wheels: | |
| name: Windows x64 | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: PyO3/maturin-action@v1 | |
| with: | |
| target: x64 | |
| args: --release --locked --out dist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-windows-x64 | |
| path: dist | |
| sdist: | |
| name: Source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - run: python -m pip install --upgrade pip maturin | |
| - run: maturin sdist --out dist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist | |
| publish: | |
| name: Publish to PyPI | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| needs: [linux-wheels, macos-wheels, windows-wheels, sdist] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/tencirpauli | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Verify release artifacts | |
| env: | |
| RELEASE_TAG: ${{ github.event.release.tag_name }} | |
| run: | | |
| python - <<'PY' | |
| import os | |
| import tarfile | |
| import zipfile | |
| from pathlib import Path | |
| tag = os.environ["RELEASE_TAG"] | |
| expected = tag[1:] if tag.startswith("v") else tag | |
| artifacts = [path for path in Path("dist").rglob("*") if path.is_file()] | |
| wheels = [path for path in artifacts if path.suffix == ".whl"] | |
| sdists = [path for path in artifacts if path.name.endswith(".tar.gz")] | |
| assert len(wheels) == 5, f"expected 5 wheels, found {len(wheels)}" | |
| assert len(sdists) == 1, f"expected 1 sdist, found {len(sdists)}" | |
| for wheel in wheels: | |
| with zipfile.ZipFile(wheel) as archive: | |
| names = set(archive.namelist()) | |
| metadata_name = next( | |
| name for name in names if name.endswith(".dist-info/METADATA") | |
| ) | |
| metadata = archive.read(metadata_name).decode() | |
| assert f"Name: tencirpauli\n" in metadata | |
| assert f"Version: {expected}\n" in metadata | |
| assert any(name.endswith("/LICENSE") for name in names) | |
| with tarfile.open(sdists[0], "r:gz") as archive: | |
| names = archive.getnames() | |
| pkg_info = next(name for name in names if name.endswith("/PKG-INFO")) | |
| metadata = archive.extractfile(pkg_info).read().decode() | |
| assert f"Name: tencirpauli\n" in metadata | |
| assert f"Version: {expected}\n" in metadata | |
| assert any(name.endswith("/LICENSE") for name in names) | |
| PY | |
| - uses: pypa/gh-action-pypi-publish@release/v1 |