Release v0.0.25 #21
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: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/test.yml | |
| # Verify the tag version matches Cargo.toml before publishing anything | |
| verify: | |
| name: Verify version | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: All package manifests agree | |
| run: bash scripts/check-versions.sh | |
| - name: Check tag matches workspace version | |
| run: | | |
| TAG="${GITHUB_REF_NAME#v}" | |
| CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') | |
| if [ "$TAG" != "$CARGO_VERSION" ]; then | |
| echo "Tag v$TAG does not match Cargo.toml version $CARGO_VERSION" | |
| exit 1 | |
| fi | |
| crates-io: | |
| name: Publish to crates.io | |
| needs: verify | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo publish -p nj --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| pypi-build: | |
| name: Build wheels (${{ matrix.target }}) | |
| needs: verify | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64 | |
| manylinux: auto | |
| - os: ubuntu-latest | |
| target: aarch64 | |
| manylinux: auto | |
| - os: macos-latest | |
| target: universal2-apple-darwin | |
| - os: windows-latest | |
| target: x86_64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: cp README.md python/README.md | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - uses: PyO3/maturin-action@v1 | |
| with: | |
| command: build | |
| # Nightly toolchain: the published wheels enable `nj/simd`, which uses | |
| # the unstable `portable_simd` feature for the explicit core::simd | |
| # distance kernel (~5-7x faster distance computation than scalar). | |
| # End users install the prebuilt wheel and never need nightly themselves. | |
| # Pinned for reproducible releases — keep in sync with the `simd-nightly` | |
| # job in test.yml; bump both together. The sdist (built on stable) keeps | |
| # the autovectorized scalar kernel, so source installs need no nightly. | |
| rust-toolchain: nightly-2026-06-02 | |
| # `--features` is listed in full (not just the simd delta) so the build is | |
| # correct whether maturin merges with or replaces `[tool.maturin] features`. | |
| # The crate is built with pyo3's `abi3-py310` feature, so a single | |
| # stable-ABI wheel per platform covers CPython 3.10+ — no per-minor | |
| # interpreter list needed. | |
| args: > | |
| --release | |
| --out dist | |
| --features pyo3/extension-module,nj/parallel,nj/simd | |
| target: ${{ matrix.target }} | |
| manylinux: ${{ matrix.manylinux }} | |
| working-directory: python | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{matrix.os}}-${{ matrix.target }} | |
| path: python/dist | |
| pypi-sdist: | |
| name: Build sdist | |
| needs: verify | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: cp README.md python/README.md | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| working-directory: python | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: python/dist | |
| pypi-publish: | |
| name: Publish to PyPI | |
| needs: [pypi-build, pypi-sdist] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/nj_py | |
| permissions: | |
| id-token: write # required for OIDC trusted publishing | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: wheels-* | |
| merge-multiple: true | |
| path: dist | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| github-release: | |
| name: Create GitHub release | |
| needs: [crates-io, pypi-publish, npm] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version | |
| id: version | |
| run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| body: | | |
| | Registry | Package | | |
| |----------|---------| | |
| | crates.io | https://crates.io/crates/nj/${{ steps.version.outputs.version }} | | |
| | PyPI | https://pypi.org/project/nj_py/${{ steps.version.outputs.version }}/ | | |
| | npm | https://www.npmjs.com/package/@holmrenser/nj/v/${{ steps.version.outputs.version }} | | |
| npm: | |
| name: Publish to npm | |
| needs: verify | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # required for OIDC trusted publishing | |
| contents: read # required to checkout code | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: wasm -> wasm/target | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| registry-url: https://registry.npmjs.org | |
| - run: cp README.md wasm/README.md | |
| - run: npm ci | |
| working-directory: wasm | |
| - run: CARGO_TARGET_DIR=target npm run build | |
| working-directory: wasm | |
| - run: npm publish --access public --provenance | |
| working-directory: wasm |