name: Publish Release
on:
push:
tags:
- 'v*.*.*'
jobs:
publish-crates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Verify version matches tag
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
CARGO_VERSION=$(grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2)
echo "Tag version: $TAG_VERSION"
echo "Cargo.toml version: $CARGO_VERSION"
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
echo "Error: Tag version ($TAG_VERSION) doesn't match Cargo.toml version ($CARGO_VERSION)"
exit 1
fi
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
build-binaries:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
arch: x86_64
- target: aarch64-unknown-linux-gnu
arch: aarch64
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build binary
run: |
cargo build --release --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Package binary
run: |
cd target/${{ matrix.target }}/release
tar czf fasterp-${{ github.ref_name }}-linux-${{ matrix.arch }}.tar.gz fasterp
mv fasterp-${{ github.ref_name }}-linux-${{ matrix.arch }}.tar.gz ${{ github.workspace }}/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: fasterp-linux-${{ matrix.arch }}
path: fasterp-${{ github.ref_name }}-linux-${{ matrix.arch }}.tar.gz
create-release:
needs: [publish-crates, build-binaries]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref_name }}
generate_release_notes: true
body: |
## Installation
### Via cargo
```bash
cargo install fasterp
```
### Pre-built binaries
Download the appropriate binary for your platform from the assets below:
- `fasterp-${{ github.ref_name }}-linux-x86_64.tar.gz` - Linux x86_64
- `fasterp-${{ github.ref_name }}-linux-aarch64.tar.gz` - Linux ARM64
files: |
artifacts/**/*.tar.gz
draft: false
prerelease: false