This repository contains a GitHub Action allowing you to hydrate *.tpl
files from the environment. It's essentially envsubst
, GitHub Action'ified.
Add the following step
to a GitHub Actions workflow.
- name: Generate Database Config
uses: perxhealth/template-substitution-action@v1
with:
from: ci/templates/database-config.json.tpl
to: app/repo/database-config.json
The Action currently expects two required inputs, and no further optional inputs.
-
from
Path to a file on local disk expected to be in
*.tpl
format, from which we'll generate the hydrated file. -
to
Path to desired output location on local disk where the hydrated file will be placed. Includes file name.
The Action currently supports a single output.
-
location
Essentially provides the
to
input as an output, useful in cases whereto
may have been dynamically generated.
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 [email protected]:perxhealth/template-substitution-action
$ cd template-substitution-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
There's no server to run, or any particular commands to be aware of during active development. The best way to make sure your changes behave as intended is to write unit tests.
The repositories 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. The test suite can be run with the following command...
$ pnpm test