https://github.com/actions-able/envsubst-action
Github action of envsubst (utility of GNU gettext https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html)
https://github.com/actions-able/envsubst-action
github-actions hacktoberfest utility
Last synced: 4 months ago
JSON representation
Github action of envsubst (utility of GNU gettext https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html)
- Host: GitHub
- URL: https://github.com/actions-able/envsubst-action
- Owner: actions-able
- License: mit
- Created: 2023-01-19T14:14:36.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-17T08:50:33.000Z (5 months ago)
- Last Synced: 2025-02-27T21:47:51.781Z (4 months ago)
- Topics: github-actions, hacktoberfest, utility
- Language: Shell
- Homepage:
- Size: 27.3 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.adoc
Awesome Lists containing this project
README
= Envsubst GitHub Action
This GitHub Action substitutes the values of environment variables in your files using `envsubst`, a powerful utility from GNU gettext.
It provides a flexible and efficient way to dynamically update configuration files, templates, and other text-based resources in your CI/CD pipeline.== Why Use This Action?
* *Simplify Configuration Management*: Easily update configuration files with environment-specific values without manual intervention.
* *Enhance CI/CD Workflows*: Seamlessly integrate dynamic content substitution into your GitHub Actions pipelines.
* *Flexible File Handling*: Process single files or multiple files using patterns, adapting to various project structures.
* *Maintain Security*: Keep sensitive data in GitHub Secrets and inject them safely into your files during the CI/CD process.
* *Reduce Human Error*: Automate the process of updating environment-specific values, minimizing the risk of manual mistakes.== Prerequisites
* Your repository must be checked out using `actions/checkout@v4` or a similar action.
* Familiarity with environment variables and GitHub Actions workflows.== Usage Examples
=== Substitute envs in a single file
This example demonstrates how to substitute environment variables in a specific file:
[source,yaml]
----
- uses: actions/checkout@v4
with:
fetch-depth: 0- name: Substitute environment variables
uses: actions-able/envsubst-action@v1
with:
input-file: 'deployment.yaml'
output-file: 'new-deployment.yaml'
env:
IMAGE_NAME: 'my-custom-image:1.0.0'
----=== Substitute envs in multiple files using patterns
This example shows how to process multiple files matching a specific pattern:
[source,yaml]
----
- uses: actions/checkout@v4
with:
fetch-depth: 0- name: Substitute environment variables in multiple files
uses: actions-able/envsubst-action@v1
with:
input-file-pattern: '*.yaml'
output-file-suffix: '.subst'
env:
IMAGE_NAME: 'my-custom-image:1.0.0'
----In this configuration, output filenames will have the `.subst` suffix (e.g., `deployment.yaml.subst`).
== Parameters
[cols="2a,6a,1a",options="header"]
|===
|Name
|Description
|Default value|working-directory
|Directory where to find the input file(s)
|`.`|input-file
|Path to the input file. Requires `output-file` to be set if defined.NOTE: Cannot be used with `input-file-pattern`.
||output-file
|Path to the output file. Requires `input-file` to be set if defined.
||input-file-pattern
|Pattern of input files. Uses GNU `find -name` for file matching.NOTE: Cannot be used with `input-file`.
||output-file-suffix
|Suffix added to filenames for output files when using `input-file-pattern`.
|`.subst`|===
== Additional Information
For more details on `envsubst`, refer to the https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html[GNU gettext documentation].