rsleigh 0.4.0

SLEIGH (.slaspec) parser and Rust decoder/P-code emitter codegen — Ghidra-compatible disassembly in pure Rust
Documentation
name: release

on:
  push:
    tags:
      - "v*"
  workflow_dispatch:
    inputs:
      tag:
        description: "Tag to build + attach artifacts to (e.g. v0.3.0)"
        required: true
        type: string

permissions:
  contents: write

jobs:
  build:
    name: build ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-22.04
            target: x86_64-unknown-linux-gnu
            archive: tar.gz
          - os: ubuntu-22.04
            target: aarch64-unknown-linux-gnu
            archive: tar.gz
            cross: true
          - os: macos-14
            target: aarch64-apple-darwin
            archive: tar.gz
          - os: macos-13
            target: x86_64-apple-darwin
            archive: tar.gz
          - os: windows-2022
            target: x86_64-pc-windows-msvc
            archive: zip
    env:
      REF_NAME: ${{ github.event.inputs.tag || github.ref_name }}
      TARGET: ${{ matrix.target }}
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.inputs.tag || github.ref }}

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Install cross (linux aarch64 only)
        if: matrix.cross == true
        run: cargo install cross --locked

      - name: Generate decoder crates
        run: cargo run --release -p rsleigh-generate

      - name: Build (native)
        if: matrix.cross != true
        run: cargo build --release -p rsleigh-cli --target "$TARGET"
        shell: bash

      - name: Build (cross)
        if: matrix.cross == true
        run: cross build --release -p rsleigh-cli --target "$TARGET"
        shell: bash

      - name: Package (unix)
        if: matrix.archive == 'tar.gz'
        shell: bash
        run: |
          NAME="rsleigh-${REF_NAME}-${TARGET}"
          cd "target/${TARGET}/release"
          tar czf "../../../${NAME}.tar.gz" rsleigh
          cd ../../..
          shasum -a 256 "${NAME}.tar.gz" > "${NAME}.tar.gz.sha256"

      - name: Package (windows)
        if: matrix.archive == 'zip'
        shell: pwsh
        run: |
          $name = "rsleigh-$env:REF_NAME-$env:TARGET"
          Compress-Archive -Path "target/$env:TARGET/release/rsleigh.exe" -DestinationPath "$name.zip"
          (Get-FileHash -Algorithm SHA256 "$name.zip").Hash > "$name.zip.sha256"

      - name: Upload artifacts to release
        uses: softprops/action-gh-release@v2
        with:
          tag_name: ${{ github.event.inputs.tag || github.ref_name }}
          files: |
            rsleigh-*.tar.gz
            rsleigh-*.zip
            rsleigh-*.sha256