Artifact unique names ++++++++ #20
Workflow file for this run
This file contains 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: Build and publish wheels | |
on: | |
push: | |
tags: | |
- "v*.*.*" # Only run on version tags like v0.1.0 | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] # Supported Python versions | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install maturin | |
run: | | |
python -m pip install --upgrade pip | |
pip install maturin | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Build wheels on macOS and Linux | |
if: runner.os != 'Windows' | |
run: | | |
maturin build --release --skip-auditwheel --out dist | |
ls -la dist # List contents of dist to verify wheels are built | |
- name: Build wheels on Windows | |
if: runner.os == 'Windows' | |
run: | | |
# Install Visual Studio Build Tools for Rust on Windows | |
choco install visualstudio2019buildtools --version=16.11.7 | |
maturin build --release --out dist | |
dir dist # List contents of dist to verify wheels are built | |
- name: Upload dist directory as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.python-version }}-${{ matrix.os }} # Use GitHub run ID for uniqueness | |
path: dist # Upload dist directory as an artifact | |
upload-to-pypi: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python-version: [ '3.8', '3.9', '3.10', '3.11' ] # Match the build matrix | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v2 | |
- name: Download dist directory artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist-${{ matrix.python-version }}-${{ matrix.os }} # Use the common artifact name | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install maturin | |
run: pip install maturin | |
- name: Show contents of dist directory | |
run: ls -la dist | |
- name: Upload wheels to PyPI | |
uses: pypa/gh-action-pypi-publish@v1.5.1 | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_token }} | |
packages_dir: dist # Ensure it points to the correct output directory |