Skip to content

Release

Release #11

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --check
- name: Clippy
run: cargo clippy -- -D warnings
- name: Test
run: cargo test
build:
name: Build (${{ matrix.target }})
needs: test
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- target: aarch64-apple-darwin
runner: macos-latest
- target: x86_64-apple-darwin
runner: macos-latest
- target: x86_64-unknown-linux-musl
runner: ubuntu-latest
- target: aarch64-unknown-linux-musl
runner: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl tools (Linux)
if: contains(matrix.target, 'linux-musl')
run: sudo apt-get install -y musl-tools
- uses: Swatinem/rust-cache@v2
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Rename binary
run: cp target/${{ matrix.target }}/release/cship cship-${{ matrix.target }}
- name: Validate binary
run: |
file cship-${{ matrix.target }}
test -s cship-${{ matrix.target }} || { echo "ERROR: binary is empty"; exit 1; }
- uses: actions/upload-artifact@v4
with:
name: cship-${{ matrix.target }}
path: cship-${{ matrix.target }}
release:
name: Publish GitHub Release
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
- uses: softprops/action-gh-release@v2
with:
files: cship-*/cship-*