name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build - ${{ matrix.platform.os }}
runs-on: ${{ matrix.platform.runs-on }}
strategy:
fail-fast: false
matrix:
platform:
- os: linux-x86_64
runs-on: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin: deepseek-rust-cli
use-cross: false
- os: linux-aarch64
runs-on: ubuntu-latest
target: aarch64-unknown-linux-gnu
bin: deepseek-rust-cli
use-cross: true
- os: windows-x86_64
runs-on: windows-latest
target: x86_64-pc-windows-msvc
bin: deepseek-rust-cli.exe
use-cross: false
- os: macos-x86_64
runs-on: macos-latest
target: x86_64-apple-darwin
bin: deepseek-rust-cli
use-cross: false
- os: macos-aarch64
runs-on: macos-latest
target: aarch64-apple-darwin
bin: deepseek-rust-cli
use-cross: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.target }}
- name: Install cross (for ARM64 Linux)
if: matrix.platform.use-cross
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall --no-confirm cross
- name: Build
run: |
if [ "${{ matrix.platform.use-cross }}" = "true" ]; then
cross build --release --target ${{ matrix.platform.target }}
else
cargo build --release --target ${{ matrix.platform.target }}
fi
shell: bash
- name: Package
shell: bash
run: |
mkdir -p dist
cp target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} dist/
if [ "${{ matrix.platform.os }}" = "windows-x86_64" ]; then
cd dist
7z a ../deepseek-rust-cli-${{ matrix.platform.os }}.zip ${{ matrix.platform.bin }}
cd ..
# Use PowerShell for checksum on Windows
powershell.exe -Command "(Get-FileHash -Path 'deepseek-rust-cli-${{ matrix.platform.os }}.zip' -Algorithm SHA256).Hash.ToLower() + ' deepseek-rust-cli-${{ matrix.platform.os }}.zip'" > deepseek-rust-cli-${{ matrix.platform.os }}.zip.sha256
else
cd dist
tar czf ../deepseek-rust-cli-${{ matrix.platform.os }}.tar.gz ${{ matrix.platform.bin }}
cd ..
shasum -a 256 deepseek-rust-cli-${{ matrix.platform.os }}.tar.gz > deepseek-rust-cli-${{ matrix.platform.os }}.tar.gz.sha256
fi
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: deepseek-rust-cli-${{ matrix.platform.os }}
path: deepseek-rust-cli-*
publish:
name: Publish Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
pattern: deepseek-rust-cli-*
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
crates-publish:
name: Publish to Crates.io
needs: publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Publish to Crates.io
run: cargo publish --no-verify --token "${{ secrets.CARGO_REGISTRY_TOKEN }}"