orbitcast 0.1.10

Real-time WebSocket server with ActionCable protocol for Mothership
name: Release

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Version (e.g., 0.1.0)'
        required: true
        type: string

permissions:
  contents: write

jobs:
  create-release:
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.version.outputs.version }}
    steps:
      - uses: actions/checkout@v6
      - id: version
        run: echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
      - uses: softprops/action-gh-release@v2
        with:
          tag_name: v${{ inputs.version }}
          draft: true
          generate_release_notes: true

  build:
    needs: create-release
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-musl
          - os: ubuntu-24.04-arm
            target: aarch64-unknown-linux-musl
          - os: macos-15-intel
            target: x86_64-apple-darwin
          - os: macos-latest
            target: aarch64-apple-darwin
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
      - name: Install musl tools (Linux)
        if: contains(matrix.target, 'musl')
        run: sudo apt-get update && sudo apt-get install -y musl-tools
      - name: Build
        run: cargo build --release --target ${{ matrix.target }} --features postgres
      - name: Package
        run: |
          name=orbitcast-${{ matrix.target }}
          mkdir -p dist
          cp target/${{ matrix.target }}/release/orbitcast dist/$name
          gzip -9 dist/$name
      - uses: softprops/action-gh-release@v2
        with:
          tag_name: v${{ inputs.version }}
          draft: true
          files: dist/*.gz

  build-freebsd:
    needs: create-release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: cross-platform-actions/action@v0.32.0
        with:
          operating_system: freebsd
          version: '15.0'
          run: |
            curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
            . $HOME/.cargo/env
            cargo build --release --features postgres
            mkdir -p dist
            cp target/release/orbitcast dist/orbitcast-x86_64-unknown-freebsd
            gzip -9 dist/orbitcast-x86_64-unknown-freebsd
      - uses: softprops/action-gh-release@v2
        with:
          tag_name: v${{ inputs.version }}
          draft: true
          files: dist/*.gz