This repository contains a GitHub Action allowing you to export environment
variables and obtain Actions outputs as per your .tool-versions
file.
For example, if your repository contains a .tool-versions
which looks like the
following...
nodejs 16.15.0
pnpm 7.26.1
elixir 1.14.3-otp-25
erlang 25.2.2
your environment will be updated with the following variables...
NODEJS_VERSION=16.15.0
PNPM_VERSION=7.26.1
ELIXIR_VERSION=1.14.3-otp-25
ERLANG_VERSION=25.2.2
The Action will also provide outputs accordingly. Following on from the examples above...
steps:
- name: Parse versions
id: versions
uses: perxhealth/tool-versions-action@v1
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ steps.versions.outputs.pnpm_version }}
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ steps.versions.outputs.nodejs_version }}
The Action currently accepts a single, optional input.
-
location
Path on disk to the desired
.tool-versions
. defaults to./.tool-versions
.
The Action provides a *_version
output for each entry it finds in your
.tool-versions
. For example, if your .tool-versions
contains an entry like
nodejs 16.15.0
, we'll produce an output like NODEJS_VERSION=16.15.0
.
Follow the below steps to get up and running with a local, development copy of the Action.
You will need the following tools installed on your machine.
$ git clone git@github.com:perxhealth/tool-versions-action
$ cd tool-versions-action
Firstly, you'll want to ensure the correct versions of the necessary system dependencies are installed.
$ asdf install
Note: optionally, you may need to install the necessary asdf plugins first.
$ asdf plugin add nodejs
$ asdf plugin add pnpm
Lastly, go ahead and install the Action's dependencies via pnpm
$ pnpm install
Edit src/index.ts
to make your changes. There is no dev server to run, so
after (or before!) making your changes, update src/index.test.ts
to ensure the
action still performs as expected.
The repo's maintainers will take care of packaging and releasing new versions after Pull Requests have been merged. Although, we plan to automate this in future if there's enough demand.
Ensure you write tests to cover any code or behaviour you introduce.
$ pnpm test