name: 'Setup V (Vlang) Build'
description: 'Setup a V (Vlang) environment by downloading and unpacking or building the V compiler to the PATH.'
author: prantlf

branding:
  icon: power
  color: blue

inputs:
  version:
    description: >-
      Specify the version of V to use. It can be `latest` (the latest published semantic version),
      `weekly` (the latest weekly release), `master` (the latest commit in the `master` branch),
      a semantic version number (tag name) or a commit hash.
    default: latest
  use-cache:
    description: >-
      Set to `false` to ignore the cache and always perform the full installation,
      either by downloading and unpacking a binary, or by downloading sources and building.
    default: 'true'
  force-build:
    description: >-
      Set to `true` to always build V from sources, even if the binary archive is available.
    default: 'false'
  install-dependencies:
    description: >-
      Set to `false` to prevent module dependencies from `v.mod` from being installed automatically.
    default: 'true'
  global-dependencies:
    description: >-
      Set to `false` to install module dependencies from `v.mod` to `./modules` instead of to `~/.vmodules`.
    default: 'true'
  modules-dir:
    description: >-
      Set the directory for the locally installed dependencies. It is `src/modules` if `src` exists, otherwise `modules`.
    default: ''
  token:
    description: >-
      Authorization token to inspect releases and commits in the `vlang/v` repository.
      Either a GitHub personal access token or the GitHub workflow token. And if even that is not set, the GitHub workflow token from the action-execution context will be used as default.
    default: ${{ github.token }}

outputs:
  version:
    description: >-
      The actually installed version of V, as returned by `v -V`.
  bin-path:
    description: >-
      The complete path to the directory with the V compiler.
  v-bin-path:
    description: >-
      The complete path to the V compiler executable.
  used-cache:
    description: >-
      A boolean value indicating if the installation succeeded from the cache.
  was-built:
    description: >-
      A boolean value indicating if the V compiler was built from sources.

runs:
  using: 'node24'
  main: 'dist/index.js'
