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.jsonThe Action currently expects two required inputs, and no further optional inputs.
-
fromPath to a file on local disk expected to be in
*.tplformat, from which we'll generate the hydrated file. -
toPath to desired output location on local disk where the hydrated file will be placed. Includes file name.
The Action currently supports a single output.
-
locationEssentially provides the
toinput as an output, useful in cases wheretomay 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 git@github.com:perxhealth/template-substitution-action
$ cd template-substitution-actionFirstly, you'll want to ensure the correct versions of the necessary system dependencies are installed.
$ asdf installNote: optionally, you may need to install the necessary asdf plugins first.
$ asdf plugin add nodejs
$ asdf plugin add pnpmLastly, go ahead and install the Action's dependencies via pnpm
$ pnpm installThere'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