Skip to content

Fix GitHub Actions: use dtolnay/rust-toolchain instead of rust-action #2

Fix GitHub Actions: use dtolnay/rust-toolchain instead of rust-action

Fix GitHub Actions: use dtolnay/rust-toolchain instead of rust-action #2

Workflow file for this run

name: Release Rust Binary
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.1.0)'
required: true
permissions:
contents: read
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform: manylinux_2_17_x86_64
# macOS x86_64
- os: macos-13
target: x86_64-apple-darwin
platform: macosx_10_12_x86_64
# macOS ARM64 (Apple Silicon)
- os: macos-14
target: aarch64-apple-darwin
platform: macosx_11_0_arm64
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install maturin
run: pip install maturin
- name: Build wheel
working-directory: src/rust/arraysplitter
run: |
maturin build --release --target ${{ matrix.target }} --out dist
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.target }}
path: src/rust/arraysplitter/dist/*.whl
publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write # For trusted publishing
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
path: dist
pattern: wheel-*
merge-multiple: true
- name: List wheels
run: ls -la dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/