https://github.com/tvarohohlavy/inplace-envsubst-action
Github Action for envsubst of multiple files in place
https://github.com/tvarohohlavy/inplace-envsubst-action
action envsubst
Last synced: 5 months ago
JSON representation
Github Action for envsubst of multiple files in place
- Host: GitHub
- URL: https://github.com/tvarohohlavy/inplace-envsubst-action
- Owner: tvarohohlavy
- License: mit
- Created: 2022-12-08T16:44:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-08T17:29:12.000Z (over 3 years ago)
- Last Synced: 2025-10-14T05:19:42.838Z (8 months ago)
- Topics: action, envsubst
- Language: Shell
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/tvarohohlavy/inplace-envsubst-action/actions/workflows/example.yml)
# inplace-envsubst-action
Github Action for envsubst of multiple files in place
This action allows you to substitute environment variables in files.
Will replace all $VAR / ${VAR} strings in defined files. Replacement value is taken from Environmental variables if found or empty if not.
This defualt behaviour can be overriden by "variables" option listed at the end of this file.
## Usage
### Single file
deployment.json (BEFORE)
```json
{
"version": "${VERSION}",
"instance": "$INSTANCE"
}
```
ACTION
```yaml
- uses: tvarohohlavy/inplace-envsubst-action@v1.0.0
env:
VERSION: 1.2.3
INSTANCE: staging
with:
files: |
deployment.json
```
deployment.json (AFTER)
```json
{
"version": "1.2.3",
"instance": "staging"
}
```
### Multiple files
ACTION
```yaml
- uses: tvarohohlavy/inplace-envsubst-action@v1.0.0
env:
VERSION: 1.2.3
INSTANCE: staging
with:
files: |
deployment.json
test.json
apps/Dockerfile
```
### Replace only defined variables
by listing varaibles you want to have replaced you can override default behaviour of envsubst which does replace all found $VAR / ${VAR} string even if there is no matching Environmental variable
ACTION
```yaml
- uses: tvarohohlavy/inplace-envsubst-action@v1.0.0
env:
VERSION: 1.2.3
INSTANCE: staging
USER: devops
with:
variables: |
$VERSION
$INSTANCE
files: |
deployment.json
test.json
apps/Dockerfile
```