odd-box 0.1.10

a dead simple reverse proxy server and web server
name: Manually Triggered Build and Attach Artifacts Without Release

on:
  workflow_dispatch:
    inputs:
      ref:
        description: 'Branch name to manually build and attach artifacts from'
        required: true

env:
  CARGO_TERM_COLOR: always
  GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
  build:
    name: Build ${{ matrix.artifact_name }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
        
          - os: ubuntu-latest
            artifact_path: target/x86_64-unknown-linux-gnu/release/odd-box
            artifact_name: odd-box-x86_64-unknown-linux-gnu
            target: x86_64-unknown-linux-gnu

          - os: ubuntu-latest
            artifact_path: target/x86_64-unknown-linux-musl/release/odd-box
            artifact_name: odd-box-x86_64-unknown-linux-musl
            target: x86_64-unknown-linux-musl
            
          - os: windows-latest
            artifact_path: target/x86_64-pc-windows-msvc/release/odd-box.exe
            artifact_name: odd-box-x86_64-pc-windows-msvc.exe
            target: x86_64-pc-windows-msvc
            
          - os: macos-latest
            artifact_path: target/aarch64-apple-darwin/release/odd-box
            artifact_name: odd-box-aarch64-apple-darwin
            target: aarch64-apple-darwin

    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.event.inputs.ref }}

      - name: Setup Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: nightly
          
      - name: Install target
        run: rustup target add ${{ matrix.target }}

      - name: Install musl-tools
        if: matrix.target == 'x86_64-unknown-linux-musl'
        run: sudo apt-get update && sudo apt-get install -y musl-tools
        
      - name: Install NASM
        if: startsWith(matrix.os, 'windows')
        uses: ilammy/setup-nasm@v1

      - name: Configure NASM for CMake (Windows only)
        if: startsWith(matrix.os, 'windows')
        run: |
          $env:CMAKE_ASM_NASM_COMPILER = "nasm"

      - name: Build
        run: |
          if ("${{ matrix.no_default_features }}" -eq "true") {
            cargo build --release --verbose --no-default-features --target ${{ matrix.target }}
          } else {
            cargo build --release --verbose --target ${{ matrix.target }}
          }
        shell: pwsh

      - name: Rename Artifact
        run: mv ${{ matrix.artifact_path }} ${{ matrix.artifact_name }}
        
      - name: Upload Artifact
        uses: actions/upload-artifact@v3
        with:
          name: ${{ matrix.artifact_name }}
          path: ${{ matrix.artifact_name }}