name: Release
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary-name: aliyah
- os: macos-latest
target: x86_64-apple-darwin
binary-name: aliyah
- os: windows-latest
target: x86_64-pc-windows-msvc
binary-name: aliyah.exe
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build Release Binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package Binary
shell: bash
run: |
cp target/${{ matrix.target }}/release/${{ matrix.binary-name }} .
# Special handling for macOS to include dylib dependencies
if [ "${{ matrix.os }}" = "macos-latest" ]; then
mkdir -p lib
# Try to copy required dylibs if they exist
[ -f /usr/lib/libc++.1.dylib ] && cp /usr/lib/libc++.1.dylib lib/ || true
[ -f /usr/lib/libc++abi.dylib ] && cp /usr/lib/libc++abi.dylib lib/ || true
# Fix binary to use relative paths
install_name_tool -change /usr/lib/libc++.1.dylib @executable_path/../lib/libc++.1.dylib ${{ matrix.binary-name }} || true
# Create archive with libs
tar czf aliyah-${{ matrix.target }}.tar.gz ${{ matrix.binary-name }} lib/
elif [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a aliyah-${{ matrix.target }}.zip ${{ matrix.binary-name }}
else
tar czf aliyah-${{ matrix.target }}.tar.gz ${{ matrix.binary-name }}
fi
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: aliyah-${{ matrix.target }}
path: |
*.tar.gz
*.zip
publish-crate:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Publish to crates.io
run: |
cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish --allow-dirty
pypi:
runs-on: ubuntu-latest
permissions:
id-token: write steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Fix Python setup.py
run: |
# Create a simple inline README if it doesn't exist
if [ ! -f "python/README.md" ]; then
echo "# Aliyah ML Training Monitor" > python/README.md
echo "" >> python/README.md
echo "Terminal based machine learning training monitor" >> python/README.md
echo "" >> python/README.md
echo "See the main repository at https://github.com/lovechants/Aliyah for more details." >> python/README.md
fi
# Check if setup.py is referencing the wrong README path and fix it
if grep -q "../README.md" python/setup.py; then
sed -i 's|"../README.md"|"README.md"|g' python/setup.py
fi
- name: Build Python package
run: |
cd python
python -m build
- name: Build and publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: python/dist/
skip-existing: true
create-release:
needs: [build, pypi, publish-crate]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: List directories
run: ls -la
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
aliyah-*/aliyah-*.tar.gz
aliyah-*/aliyah-*.zip
draft: false
prerelease: false