Skip to content

Commit

Permalink
Added env_file description and bumped version of release to 3.5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
AkhileshNS committed Sep 18, 2020
1 parent 56d4e6b commit fe8c4ef
Showing 1 changed file with 60 additions and 12 deletions.
72 changes: 60 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand Down Expand Up @@ -76,6 +76,7 @@ The action comes with additional options that you can use to configure your proj
| delay | false | Time (in seconds) to wait before performing healthcheck. Defaults to 0 seconds | 5 |
| procfile | false | Contents of the Procfile to save and deploy | web: npm start |
| rollbackonhealthcheckfailed | false | When set to true this will attempt to rollback to the previous release if the healthcheck fails | true or false |
| env_file | false | path to an env file (with respect to appdir) | /.env |
## Examples
Expand All @@ -98,7 +99,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand All @@ -125,7 +126,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand Down Expand Up @@ -164,7 +165,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand All @@ -191,7 +192,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand Down Expand Up @@ -220,7 +221,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand Down Expand Up @@ -249,7 +250,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand Down Expand Up @@ -280,7 +281,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand Down Expand Up @@ -310,7 +311,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand Down Expand Up @@ -340,7 +341,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand Down Expand Up @@ -373,7 +374,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand All @@ -389,6 +390,53 @@ On that note, if you've set these variables and have deployed your app, you can

**PLEASE NOTE**: The "**HD\_**" will be scrapped from the variable your name by the action. So in your project, "**FIREBASE_API_KEY**" will be passed instead of "**HD_FIREBASE_API_KEY**" (for example) and you can see this if you check your Heroku App's config vars. We understand that this can be confusing but this is again to ensure Platform independence and so that you don't have to use HD_FIREBASE_API_KEY if you choose to stop using Heroku

### ENV File

You can if you wish also pass the path to an env file as an option to the action. The action will then read that file and set the config vars accordingly in Heroku

_.github/workflows/main.yml_

```yaml
name: Deploy
on:
push:
branches:
- master # Changing the branch here would also work
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/[email protected] # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
heroku_email: "YOUR EMAIL"
env_file: ".env"
env:
HD_FIREBASE_API_KEY: ${{secrets.FIREBASE_API_KEY}}
HD_RANDOM_DATA: "Hello"
```

Example env file

```
HELLO=world
WORLD=hello
```
There are two important points to keep in mind when using the **env_file** option.
1. The first is that in can be used in conjunction with **env** option of the action as you have seen above
2. The second is that unlike in the **env** option, you do not need to prefix the env variables in the .env file with "HD\_".
(For those of you who are wondering why this is the case, when using the **env** option, the env variables are passed directly into the process along with all the other env variables passed by GitHub Actions, the language you are using etc and the "HD\_" in that case is to help differentiate your env variables from them. But when using a file to pass the env variables, the action manually reads the file so there is no chance of stray env variables being passed by your language, github actions etc and hence no need to add the "HD\_")
Also note that using a file (which can be named anything so long as it follows the format of a standard env file) can be useful if you're trying to send a very large number of env variables to Heroku, it does mean that keeping the .env file secure and private is entirely in your hands so tread with caution.
## Procfile Passing
In some cases, you might want to be able to set the Procfile within the action itself instead of declaring it manually in your project. Although this approach is not recommended in favor of just using multiple branches, it might still be useful in some edge cases. You can set the Procfile in the action by using the **procfile** option of the action like so:
Expand All @@ -408,7 +456,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.4.6 # This is the action
- uses: akhileshns/heroku-deploy@v3.5.6 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "YOUR APP's NAME" #Must be unique in Heroku
Expand Down

0 comments on commit fe8c4ef

Please sign in to comment.