name: Setup the toolchain
description: Sets up the toolchain for the project
inputs:
  node-version:
    description: The version of Node to use
    type: number
    default: 16
    required: true
  jdk-version:
    description: The Java JDK version to use, if specified
    type: number
  go-version:
    description: The semver version of Go to use, if specified
    type: string

runs:
  using: composite
  steps:
    - name: Set up Node.js
      uses: actions/setup-node@v3.5.1
      with:
        node-version: ${{ inputs.node-version }}
        cache: yarn
    - name: Set up JDK
      if: ${{ inputs.jdk-version != 0 }}
      uses: actions/setup-java@v3.6.0
      with:
        distribution: temurin
        java-version: ${{ inputs.jdk-version }}
    - name: Set up Go
      if: ${{ inputs.go-version != '' }}
      uses: actions/setup-go@v3
      with:
        go-version: ${{ inputs.go-version }}
