diff --git a/LICENSE b/LICENSE index 05bb410..a02f34b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Forest Anderson +Copyright (c) 2021 Forest Anderson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 8e87de2..a8bae70 100644 --- a/README.md +++ b/README.md @@ -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/create-envfile@v1.1 + +## 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) \ No newline at end of file