name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
container: ghcr.io/loonghao/rust-toolkit:cross-compile
strategy:
matrix:
target:
- x86_64-pc-windows-gnu
- i686-pc-windows-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-apple-darwin
- aarch64-apple-darwin
steps:
- uses: actions/checkout@v4
- name: Check Rust version
shell: bash
run: |
echo "🦀 Checking Rust version in Docker container..."
rustc --version
echo "📦 Cargo version:"
cargo --version
- name: Build release binary
shell: bash
run: |
echo "🚀 Building release binary for ${{ matrix.target }}"
# Set environment for zero-dependency builds
export RUSTFLAGS="-C target-feature=+crt-static"
export OPENSSL_STATIC=1
export PKG_CONFIG_ALLOW_CROSS=1
# Build the binary
cargo build --release --target ${{ matrix.target }}
echo "✅ Build completed successfully!"
- name: Upload release artifacts
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/${{ matrix.target }}/release/py2pyd*
token: ${{ secrets.GITHUB_TOKEN }}