-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37df824
commit 8cfea13
Showing
2 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
# Create Envfile Github Action | ||
|
||
**Name: SpicyPizza/create-envfile@v1** | ||
[![GitHub | ||
release](https://img.shields.io/github/release/SpicyPizza/create-envfile.svg?style=flat-square)](https://github.com/SpicyPizza/create-envfile/releases/latest) | ||
[![GitHub | ||
marketplace](https://img.shields.io/badge/marketplace-create--env--file-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/create-env-file) | ||
[![Licence](https://img.shields.io/github/license/SpicyPizza/create-envfile)](https://github.com/SpicyPizza/create-envfile/blob/master/LICENSE) | ||
|
||
Github Action to create a .env file with Github Secrets | ||
### SpicyPizza/[email protected] | ||
|
||
## About | ||
|
||
A Github Action to create a .env file with Github Secrets. This is useful when | ||
you are creating artifacts that need to contain secrets stored in Github | ||
Secrets. This creates a file with variables that are defined in the Action | ||
config. | ||
|
||
## Usage | ||
|
||
The action looks for environment variables that start with `INPUT_ENVKEY_` and creates an envfile with them. To add a key to the envfile, add a key/pair to the `with:` section. It must begin with `envkey_`. | ||
The Action looks for environment variables that start with `envkey_` and creates | ||
an envfile with them. These are defined in the `with` section of the Action | ||
config. Here is an example of it in use: | ||
|
||
```yml | ||
name: Create envfile | ||
|
@@ -31,14 +44,34 @@ jobs: | |
file_name: .env | ||
``` | ||
In this example, there are 6 keys: | ||
## Inputs | ||
In the example above, there are several key/value pairs that will be added to | ||
the envfile: | ||
| Name | Description | | ||
|---------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------| | ||
| `envkey_DEBUG`, `envkey_SOME_API_KEY` | These values can be whatever, and they will be added to the envfile as `DEBUG` and `SOME_API_KEY` . | | ||
| `envkey_SOME_API_KEY` | This one will use a secret stored in the repository's Github Secrets, and add it to the file as `SECRET_KEY` | | ||
| `directory` (**Optional**) | This key will set the directory in which you want to create `env` file. (Action will fail if the specified directory doesn't exist.) | | ||
| `file_name` (**Optional**) | Set the name of the output envfile. Defaults to `.env` | | ||
|
||
`envkey_DEBUG`, `envkey_SOME_API_KEY` - String values | ||
Assuming that the Github Secret that was used is `password123`, the .env file | ||
that is created from the config above would contain: | ||
|
||
``` | ||
DEBUG: false | ||
SOME_API_KEY: "123456abcdef" | ||
SECRET_KEY: password123 | ||
``` | ||
|
||
`envkey_SECRET_KEY` - A secret stored in the repository's Github Secrets | ||
## Potential Issues | ||
|
||
`some_other_variable` - Won't be used because it doesn't start with `envkey_` | ||
### Warnings | ||
|
||
`directory`(**Optional**) - This key will set the directory in which you want to create `env` file. (**Action will fail if the specified directory doesn't exist.**) | ||
When the Action runs, it will show `Warning: Unexpected input(s) ...`. This is | ||
because Github is expecing all the potential input variables to be defined by | ||
the Action's definition. You can read more about it in [this | ||
issue](https://github.com/SpicyPizza/create-envfile/issues/10). | ||
|
||
`file_name`(**Optional**) - Set the name of the output envfile. Defaults to `.env` | ||
![](https://user-images.githubusercontent.com/12802646/106284483-594e2300-6254-11eb-9e5d-3a6426da0435.png) |