uiua 0.18.1

A stack-based array programming language
Documentation
name: Create Release
permissions:
  contents: write

on:
  push:
    tags:
      - '[0-9]+.[0-9]+.[0-9]+'
      - '[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+'
      - '[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'

env:
  CARGO_TERM_COLOR: always

jobs:
  # Create the release without assets
  create_release:
    name: Create release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Ensure tag matches cargo version
        run: |
          CARGO_PKG_VERSION=$(cargo pkgid | cut -d# -f2)
          if [ "${{ github.ref_name }}" != "$CARGO_PKG_VERSION" ]; then
            echo "Tag ${{ github.ref_name }} does not match cargo version $CARGO_PKG_VERSION"
            exit 1
          fi
      - name: Prepare release notes
        run: node .github/scripts/get-release-notes.js ${{ github.ref_name }} >> release_notes.md
      - name: Create release
        uses: softprops/action-gh-release@v1
        with:
          body_path: ./release_notes.md
          prerelease: ${{ contains(github.ref_name, 'dev') || contains(github.ref_name, 'rc') }}

  # Create the binaries and upload them as release assets
  create_binaries:
    name: Create binary
    needs: create_release
    runs-on: ${{ matrix.os }}
    env:
      BINARY_EXT: ${{ matrix.os == 'windows-latest' && '.exe' || '' }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - { os: macos-latest,   target: x86_64-apple-darwin,       features: "audio,window"                   }
          - { os: macos-latest,   target: aarch64-apple-darwin,      features: "audio,window"                   }
          - { os: ubuntu-latest,  target: x86_64-unknown-linux-gnu,  features: "full"                           }
          - { os: ubuntu-latest,  target: x86_64-unknown-linux-gnu,  features: "window",      name: "-no-audio" }
          - { os: windows-latest, target: x86_64-pc-windows-msvc,    features: "full"                           }
          - { os: windows-latest, target: aarch64-pc-windows-msvc,   features: "audio,window"                   }
    steps:
      - uses: actions/checkout@v4

      # Install dependencies
      - if: matrix.target == 'x86_64-unknown-linux-musl'
        run: sudo apt-get install -y musl-tools
      - if: matrix.os == 'ubuntu-latest'
        run: |
          sudo apt-get update -y
          sudo apt-get --fix-missing install -y
          sudo apt-get install -y libasound2-dev libudev-dev libx11-dev libjpeg-dev libclang-dev

      # Build
      - name: Install target
        run: rustup target add ${{matrix.target}}
      - name: Build
        run: cargo build --bin uiua --features ${{matrix.features}} --release --target ${{matrix.target}} --verbose

      - name: Zip
        run: 7z a -tzip uiua-bin-${{matrix.target}}${{matrix.name}}.zip ./target/${{matrix.target}}/release/uiua${{env.BINARY_EXT}}

      - name: Upload release assets
        uses: softprops/action-gh-release@v1
        with:
          files: |
            uiua-bin-${{matrix.target}}${{matrix.name}}.zip