Skip to content

fix: aarch64 binary releases #4

fix: aarch64 binary releases

fix: aarch64 binary releases #4

name: Release Rust CLI Binaries
on:
push:
tags:
- 'cli@v*'
workflow_dispatch:
permissions:
contents: write
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version from tag
id: get_version
run: echo "version=${GITHUB_REF#refs/tags/cli@v}" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: CLI v${{ steps.get_version.outputs.version }}
body: |
# Snob CLI v${{ steps.get_version.outputs.version }}
Standalone binaries for the Snob CLI tool.
## Installation
### Quick Install (Linux/macOS)
```bash
curl -sSL https://raw.githubusercontent.com/alexpasmantier/snob/main/install.sh | bash
```
### Manual Download
Download the appropriate binary for your platform below and add it to your PATH.
## Checksums
Verify your download with the provided SHA256 checksums.
draft: false
prerelease: false
build:
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
cross: false
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
cross: true
- target: x86_64-unknown-linux-musl
os: ubuntu-22.04
cross: true
- target: x86_64-apple-darwin
os: macos-13
cross: false
- target: aarch64-apple-darwin
os: macos-14
cross: false
- target: x86_64-pc-windows-msvc
os: windows-latest
cross: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-
${{ runner.os }}-cargo-
- name: Build binary
run: |
if [ "${{ matrix.cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }} --bin snob --no-default-features
else
cargo build --release --target ${{ matrix.target }} --bin snob --no-default-features
fi
shell: bash
- name: Strip binary (Unix)
if: matrix.os != 'windows-latest'
run: |
if [ "${{ matrix.target }}" = "x86_64-unknown-linux-musl" ]; then
# musl strip might not be available, skip for musl builds
echo "Skipping strip for musl target"
elif [ "${{ matrix.cross }}" = "true" ]; then
# For cross-compiled binaries, skip stripping to avoid format mismatch
echo "Skipping strip for cross-compiled target ${{ matrix.target }}"
elif [ "${{ matrix.os }}" = "macos-13" ] || [ "${{ matrix.os }}" = "macos-14" ]; then
# On macOS, use native strip
strip target/${{ matrix.target }}/release/snob
else
# Native Linux build
strip target/${{ matrix.target }}/release/snob
fi
shell: bash
- name: Prepare binary
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp target/${{ matrix.target }}/release/snob.exe snob-${{ matrix.target }}.exe
else
cp target/${{ matrix.target }}/release/snob snob-${{ matrix.target }}
fi
shell: bash
- name: Generate checksum
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
sha256sum snob-${{ matrix.target }}.exe > snob-${{ matrix.target }}.exe.sha256
else
sha256sum snob-${{ matrix.target }} > snob-${{ matrix.target }}.sha256
fi
shell: bash
- name: Test binary
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
./snob-${{ matrix.target }}.exe --version
else
./snob-${{ matrix.target }} --version
fi
shell: bash
- name: Upload binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./snob-${{ matrix.target }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}
asset_name: snob-${{ matrix.target }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}
asset_content_type: application/octet-stream
- name: Upload checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./snob-${{ matrix.target }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}.sha256
asset_name: snob-${{ matrix.target }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}.sha256
asset_content_type: text/plain
generate-install-script:
needs: [create-release, build]
runs-on: ubuntu-latest
steps:
- name: Create combined checksums file
run: |
echo "# SHA256 Checksums for Snob CLI v${{ needs.create-release.outputs.version }}" > checksums.txt
echo "# Verify with: sha256sum -c checksums.txt" >> checksums.txt
echo "" >> checksums.txt
# This is a placeholder - in a real implementation, you'd download and combine all the individual checksums
echo "# Download individual .sha256 files from the release assets for verification" >> checksums.txt
- name: Upload combined checksums
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./checksums.txt
asset_name: checksums.txt
asset_content_type: text/plain