name: Release CLI
on:
push:
tags: ["cli-v*"]
workflow_dispatch:
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-15
- target: x86_64-unknown-linux-gnu
os: ubuntu-24.04
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install mise
uses: jdx/mise-action@v4
with:
install: true
bootstrap: true
bootstrap_args: "--yes"
bootstrap_skip: "task"
cache: true
- name: Cache rust build
uses: Swatinem/rust-cache@v2
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Cache ort downloads
uses: actions/cache@v6
with:
path: |
~/.cache/ort.pyke.io
~/Library/Caches/ort.pyke.io
~/AppData/Local/ort.pyke.io
key: ort-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
ort-${{ matrix.target }}-
- name: Build
if: runner.os != 'Windows'
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
run: mise run build-cli
- name: Build (Windows, bypass mbx shim)
if: runner.os == 'Windows'
shell: bash
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
run: '"$(rustup which cargo)" build --release -p docuparse-cli --features ocr'
- name: Package (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euo pipefail
staging="docuparse-cli-${{ matrix.target }}"
mkdir -p "dist/$staging"
cp "target/${{ matrix.target }}/release/docuparse-cli" "dist/$staging/"
tar -czf "dist/$staging.tar.gz" -C dist "$staging"
(
cd dist
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "$staging.tar.gz" > "$staging.tar.gz.sha256"
else
shasum -a 256 "$staging.tar.gz" > "$staging.tar.gz.sha256"
fi
)
- name: Package (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
set -euo pipefail
staging="docuparse-cli-${{ matrix.target }}"
mkdir -p "dist/$staging"
cp "target/${{ matrix.target }}/release/docuparse-cli.exe" "dist/$staging/"
powershell -NoProfile -Command "Compress-Archive -Path 'dist/$staging' -DestinationPath 'dist/$staging.zip'"
(
cd dist
sha256sum "$staging.zip" > "$staging.zip.sha256" 2>/dev/null \
|| powershell -NoProfile -Command "(Get-FileHash '$staging.zip' -Algorithm SHA256).Hash.ToLower() + ' $staging.zip'" > "$staging.zip.sha256"
)
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: docuparse-cli-${{ matrix.target }}
path: |
dist/*.tar.gz
dist/*.zip
dist/*.sha256
if-no-files-found: error
compression-level: 0
release:
name: Release
needs: build
if: startsWith(github.ref, 'refs/tags/cli-v')
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Consolidate checksums
run: |
cd dist
cat *.sha256 > SHA256SUMS
rm -- *.sha256
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
shell: bash
run: |
set -euo pipefail
tag="${GITHUB_REF_NAME}"
mapfile -t assets < <(find dist -maxdepth 1 -type f \( -name '*.tar.gz' -o -name '*.zip' -o -name 'SHA256SUMS' \) | sort)
gh release create "$tag" "${assets[@]}" \
--verify-tag \
--title "docuparse-cli ${tag#cli-v}" \
--generate-notes \
--notes "Binaries are also installable via mise's HTTP backend; see crates/docuparse-cli/README.md. PDFium and OCR models are fetched separately by the repository's mise tasks."