setup-kubectl/action.yml
Alexis Couvreur 269ea0e4a1
feat: add version-file input to read kubectl version from .tool-versions
Implements https://github.com/Azure/setup-kubectl/issues/259

- Add `version-file` input to action.yml that accepts a path to a
  .tool-versions file (asdf/mise compatible format)
- Add `parseToolVersionsFile()` helper that reads kubectl version
  from a .tool-versions file, skipping comments and blank lines
- Update `run()` to check `version-file` before `version`; when
  provided, the resolved version goes through `resolveKubectlVersion()`
  supporting both full (1.27.15) and major.minor (1.27) forms
- Add unit tests for `parseToolVersionsFile()` and the new run() path
2026-05-13 21:02:22 +02:00

18 lines
607 B
YAML

name: 'Kubectl tool installer'
description: 'Install a specific version of kubectl binary. Acceptable values are latest or any semantic version string like "v1.15.0"'
inputs:
version:
description: 'Version of kubectl'
required: false
default: 'latest'
version-file:
description: 'Path to a .tool-versions (asdf/mise) file to read the kubectl version from. Takes precedence over the version input.'
required: false
outputs:
kubectl-path:
description: 'Path to the cached kubectl binary'
branding:
color: 'blue'
runs:
using: 'node24'
main: 'lib/index.js'