Skip to content

A basic GitHub Action to install an arbitrary tool binary into $PATH for use within a workflow.

License

Notifications You must be signed in to change notification settings

k3rnels-actions/setup-tool-binary

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

setup-tool-binary

Build and Test CodeFactor Maintenance status License GitHub release (latest by date)

Introduction

This is a very basic GitHub Action to install an arbitrary tool from a templated url. It utilizes the tool-cache to optimize install times and supports a very basic token replace templating mechanism for the url you want to download your tool from.

Note

This Action took inspiration of several other tool setup Actions, however none of them seemed to be doing what I needed, so this exists now.

Action I/O

This action does currently not utilize nor support using any form of authorization (i.e. the GitHub Token). If it is a requested feature it may get added.

Action Inputs

Input Required TemplateLiteral Description

toolName

true

toolName

The name of the tool you want to install via this action. It also populates the toolName template literal you may use in the urlTemplate and smokeTestTemplate that gets expanded to the value set here.

toolRepository

conditional

toolRepository

Conditionally required if you to use the toolRepository TemplateLiteral within the urlTemplate. Useful when installing releases from GitHub as tools (also check Usage for an example).

toolVersion

true

toolVersion

The version of the tool you want to install. It also populates the toolVersion template literal you may use in the urlTemplate that gets expanded to the value set here.

urlTemplate

true

n/a

The URL template to download your tool of choice from. By default, this is set to a reasonable assumed url pattern for GitHub releases, yet you can overwrite it with your own template.
Defaults to: https://github.com/{{toolRepository}}/{{toolName}}/releases/download/v{{version}}/{{toolName}}-{{version}}-{{platform}}-amd64.tar.gz

smokeTestTemplate

false

n/a

In case you want to run a smoke test to validate that your tool was installed properly. This only supports {{toolName}} as a template literal (for now).

Note

The following templateLiterals are currently supported within the urlTemplate:

  • {{toolRepository}} - only available if you set toolRepository in the parameters (throws an error if you use it, and it was not configured).

  • {{toolName}} - gets populated with the toolName

  • {{version}} - gets populated with the toolVersion

  • {{platform}} - gets populated with the Node.js process.platform value (except win32 which gets translated to windows)

Usage

demo.yml
on:
  # ...

jobs:
  demo:
    runs-on: ubuntu-latest
    steps:
      - name: "Install gino-keva"
        uses: k3rnels-actions/setup-tool-binary@v1
        with:
          toolName: 'gino-keva'
          toolRepository: 'philips-software'
          toolVersion: '2.0.0'
          urlTemplate: 'https://github.com/{{toolRepository}}/{{toolName}}/releases/download/v{{toolVersion}}/{{toolName}}'
          smokeTestTemplate: '{{toolName}} --help'
      - name: "Checkout Repo"
        uses: actions/checkout@v3
      # ...

Contribute

All kinds of contributions are more than welcome! However, if you plan bigger changes please open an issue first to discuss your proposed changes 😉

Licence

gplv3 or later

Just if the badge from shields.io and the LICENSE file do not make it obvious enough, this project is licenced under the GPLv3 or later.