name: install-opam-mac
description: Install opam on macOS
inputs:
  arch:
    description: The architecture of the machine
    required: false
runs:
  using: composite
  steps:
  - name: Install opam
    run: |-
      if ! [ -x "$(command -v opam)" ]; then
        echo "Downloading opam..."
        curl -sL -o "$RUNNER_TEMP/opam" "https://github.com/ocaml/opam/releases/download/2.2.0-beta3/opam-2.2.0-beta3-${{ inputs.arch }}-macos"
        echo "Installing opam..."
        install -m 755 "$RUNNER_TEMP/opam" "/usr/local/bin/opam"
        echo "Removing opam temp file..."
        rm -f "$RUNNER_TEMP/opam"
      fi
    shell: bash
