name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
env:
RUST_TOOLCHAIN: "1.92.0"
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
publish-crate:
name: Publish on crates.io
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: cargo publish
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-24.04
smoke: true
experimental: false
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
smoke: true
experimental: false
- target: x86_64-unknown-linux-musl
os: ubuntu-24.04
smoke: true
experimental: false
- target: aarch64-apple-darwin
os: macos-latest
smoke: true
experimental: false
- target: x86_64-apple-darwin
os: macos-latest
smoke: false
experimental: false
- target: x86_64-pc-windows-msvc
os: windows-latest
smoke: true
experimental: false
- target: aarch64-pc-windows-msvc
os: windows-11-arm
smoke: true
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: true
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
targets: ${{ matrix.target }}
- name: Install musl tools
if: contains(matrix.target, 'musl')
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Install LLVM (Windows ARM64)
if: matrix.target == 'aarch64-pc-windows-msvc'
shell: pwsh
run: |
if (-not (Get-Command clang -ErrorAction SilentlyContinue)) {
choco install llvm -y --no-progress
}
"C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Build
shell: bash
env:
CARGO_PROFILE_RELEASE_STRIP: symbols
CARGO_PROFILE_RELEASE_LTO: thin
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
run: |
cargo build --release --all-features --target ${{ matrix.target }}
- name: Locate binary
shell: bash
run: |
BIN="target/${{ matrix.target }}/release/rinex-cli"
if [[ "${{ matrix.target }}" == *windows* ]]; then
BIN="$BIN.exe"
fi
ls -lh "$BIN"
echo "BIN=$BIN" >> "$GITHUB_ENV"
- name: Smoke test
if: matrix.smoke
shell: bash
run: |
"$BIN" --version
"$BIN" -q -o smoke-test \
-f data/CRNX/V3/ESBC00DNK_R_20201770000_01D_30S_MO.crx.gz \
-f data/NAV/V3/ESBC00DNK_R_20201770000_01D_MN.rnx.gz \
index
- name: Package
shell: bash
run: |
VERSION="${{ github.ref_type == 'tag' && github.ref_name || format('dev-{0}', github.sha) }}"
ARCHIVE="rinex-cli-${VERSION}-${{ matrix.target }}"
mkdir -p "$ARCHIVE"
cp README.md LICENSE "$BIN" "$ARCHIVE"/
if [[ "${{ matrix.target }}" == *windows* ]]; then
ASSET="$ARCHIVE.zip"
7z a "$ASSET" "$ARCHIVE" > /dev/null
else
ASSET="$ARCHIVE.tar.gz"
tar czf "$ASSET" "$ARCHIVE"
fi
if command -v sha256sum > /dev/null; then
sha256sum "$ASSET" > "$ASSET.sha256"
else
shasum -a 256 "$ASSET" > "$ASSET.sha256"
fi
cat "$ASSET.sha256"
echo "ASSET=$ASSET" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ${{ env.ASSET }}
path: |
${{ env.ASSET }}
${{ env.ASSET }}.sha256
if-no-files-found: error
release:
name: GitHub release
if: github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
pattern: rinex-cli-*
path: dist
merge-multiple: true
- name: List assets
run: ls -lh dist
- name: Create draft release and attach binaries
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: true
files: dist/*
fail_on_unmatched_files: true