Skip to content

fix: select the GUI file-dialog backend by cargo feature (v1.2.1) #12

fix: select the GUI file-dialog backend by cargo feature (v1.2.1)

fix: select the GUI file-dialog backend by cargo feature (v1.2.1) #12

Workflow file for this run

name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (build artifacts but skip publishing)'
required: false
default: false
type: boolean
permissions:
contents: write
id-token: write
env:
CARGO_TERM_COLOR: always
jobs:
# Build Python wheels for all platforms
build-wheels:
name: Build wheels (${{ matrix.os }}, ${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
manylinux: "2_28"
# macOS ARM64
- os: macos-latest
target: aarch64-apple-darwin
# macOS x86_64
- os: macos-15
target: x86_64-apple-darwin
# Windows x86_64
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux || 'auto' }}
args: --release --out dist -m rustpix-python/Cargo.toml
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.target }}
path: dist/*.whl
# Build source distribution
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
with:
command: sdist
args: --out dist -m rustpix-python/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
# Build CLI binaries
build-cli:
name: Build CLI (${{ matrix.os }}, ${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: rustpix-cli-linux-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: rustpix-cli-macos-arm64
- os: macos-15
target: x86_64-apple-darwin
artifact_name: rustpix-cli-macos-x86_64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: rustpix-cli-windows-x86_64
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Build CLI
run: cargo build --release --package rustpix-cli --target ${{ matrix.target }}
- name: Package binary (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/rustpix dist/
cd dist
tar -czvf ${{ matrix.artifact_name }}.tar.gz rustpix
rm rustpix
- name: Package binary (Windows)
if: runner.os == 'Windows'
run: |
mkdir dist
copy target\${{ matrix.target }}\release\rustpix.exe dist\
cd dist
7z a ${{ matrix.artifact_name }}.zip rustpix.exe
del rustpix.exe
- name: Upload CLI artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: dist/*
# Publish to PyPI
publish-pypi:
name: Publish to PyPI
needs: [build-wheels, build-sdist]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') && (github.event_name != 'workflow_dispatch' || !inputs.dry_run)
environment:
name: pypi
url: https://pypi.org/p/rustpix
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
pattern: wheel-*
merge-multiple: true
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist-sdist
- name: Move sdist to dist directory
run: |
mv dist-sdist/*.tar.gz dist/
ls -la dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
packages-dir: dist/
# Publish to crates.io
publish-crates:
name: Publish to crates.io
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') && (github.event_name != 'workflow_dispatch' || !inputs.dry_run)
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: stable
- name: Publish crates (in dependency order)
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
# Publish in dependency order with delays for crates.io indexing
echo "Publishing rustpix-core..."
cargo publish -p rustpix-core --no-verify
echo "Waiting for crates.io to index..."
sleep 30
echo "Publishing rustpix-tpx..."
cargo publish -p rustpix-tpx --no-verify
sleep 30
echo "Publishing rustpix-algorithms..."
cargo publish -p rustpix-algorithms --no-verify
sleep 30
echo "Publishing rustpix-io..."
cargo publish -p rustpix-io --no-verify
sleep 30
echo "Publishing rustpix-cli..."
cargo publish -p rustpix-cli --no-verify
echo "All crates published successfully!"
# Create GitHub Release
github-release:
name: Create GitHub Release
needs: [build-wheels, build-sdist, build-cli]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Download all wheel artifacts
uses: actions/download-artifact@v4
with:
path: dist/wheels
pattern: wheel-*
merge-multiple: true
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist-sdist
- name: Move sdist to wheels directory
run: mv dist-sdist/*.tar.gz dist/wheels/
- name: Download CLI artifacts
uses: actions/download-artifact@v4
with:
path: dist/cli
pattern: rustpix-cli-*
merge-multiple: true
- name: Prepare release assets
run: |
mkdir -p release
# Copy all artifacts to release directory
cp dist/wheels/*.whl dist/wheels/*.tar.gz release/ 2>/dev/null || true
cp dist/cli/* release/ 2>/dev/null || true
ls -la release/
- name: Create GitHub Release
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2
with:
files: release/*
generate_release_notes: true
draft: ${{ inputs.dry_run || false }}
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}