Install any tool or binary with full cache, dynamic latest version, easy to configure and has presets.
- Blazingly fast ⚡
- Cache downloads using the tool cache 📦
- Supports fetching and caching latest version dynamically 🚀
- Can be configured to install almost any tool or binary 🛠️
- Has built-in presets for common tools like 🧰
- name: "Checkout the repository"
uses: actions/checkout@v4
- name: "Install Cloud SQL Proxy"
id: install-tool
uses: jcwillox/install-tool-action@v1
with:
preset: "cloud-sql-proxy"
- name: "Show Outputs"
run: |
echo "path=${{ steps.install-tool.outputs.path }}"
echo "version=${{ steps.install-tool.outputs.version }}"
- name: "Print Version"
run: |
cloud-sql-proxy --version| Name | Description | Default |
|---|---|---|
preset |
Preset to use, see Presets | |
version |
Version of the tool to install | latest |
repo |
Repository to use for defaults, see Repository | |
id |
Id to use for tool cache when not using preset or repo |
|
version_url |
URL to fetch the latest version from, see Version URL | |
version_path |
JSON path like expression to extract version from the response, see radash.get | |
version_regex |
Regex to extract the version from the response, see Version URL | (?<version>[\\d.]+) |
download_url |
URL to download the tool from, see Download URL | |
download_name |
Rename downloaded binaries, does not work with archives, see Download Name | |
bin_path |
Sub-path of a downloaded archive to add to PATH | |
cache |
Set to false to disable use of the tool cache |
true |
token |
Token to use for GitHub requests | GITHUB_TOKEN |
| Name | Description |
|---|---|
path |
Path to the installed tool, will be the directory of the tool and does not include bin_path |
version |
The resolved version of the tool |
| Name | URL |
|---|---|
infisical-cli |
https://github.com/Infisical/infisical |
cloud-sql-proxy |
https://github.com/GoogleCloudPlatform/cloud-sql-proxy |
github-cli |
https://github.com/cli/cli |
See presets/index.ts for examples of how to configure a custom tool.
Custom presets are very simple to create, for example to the infisical-cli all you need to set is
repo: "infisical/infisical"
download_url: "/releases/download/infisical-cli/v{{version}}/infisical_{{version}}_{{os}}_{{arch}}.{{archive}}"Setting the repo input will set defaults for the tool, this includes
version_url-https://api.github.com/repos/${repo}/releases/latestversion_path-tag_namedownload_url- whendownload_urlstarts with/, e.g. is a relative urlhttps://github.com/${repo}/${download_url}
The URL to fetch the latest version from defaults to https://api.github.com/repos/${repo}/releases/latest for GitHub repositories, this can be overridden using the version_url input.
The version can be extracted from the response using version_path and version_regex, the response payload is JSON radash.get is used to extract the version from the response which is JSON-path like.
Additionally or alternatively you can use version_regex to extract the version from the response, or result from version_path, the regex can have a named capture group called version which will be used as the version, otherwise the entire match will be used. The regex defaults to (?<version>[\\d.]+).
The download_url field supports templating, using radash.template, the following variables are available in addition to the inputs
const templateArgs = {
...config, // input values are merged
os: process.platform === "win32" ? "windows" : process.platform,
arch: process.arch === "x64" ? "amd64" : process.arch,
arch2: process.arch,
exe: process.platform === "win32" ? ".exe" : "",
archive: process.platform === "win32" ? "zip" : "tar.gz",
};If the downloaded file is an archive, it will be automatically extracted base on the extension, additionally the bin_path input can be used to specify a sub-path of the archive to add to PATH, it defaults to the root.
When downloading a binary (not an archive), you can rename the downloaded file using the download_name input, this is useful when the downloaded file has a version or arch in the name, e.g. cloud-sql-proxy.linux.amd64 can be renamed to cloud-sql-proxy using download_name: cloud-sql-proxy.