GitHub Action that sets Heroku environment variables from AWS SSM Parameter Store. This Action was created to efficiently synchronize when using the same environment variables on AWS and Heroku.
Input | Required | Default | Info |
---|---|---|---|
path | Yes | N/A | The path to the environment variable in the AWS SSM Parameter Store that you want to set in Heroku |
Yes | N/A | Heroku email | |
token | Yes | N/A | Heroku token |
app | Yes | N/A | Heroku app name |
And you need to set AWS credentials by using like AWS Credentials for GitHub Actions.
First of all, this actions retrieve environment variables from AWS SSM Parameter Store specifying path
input. This mean when you set like under CLI command, you can retrieve under '/test/'
recursively if you specified path as '/test/'
.
aws ssm put-parameter \
--name "/test/VALUE1" \
--value "test1" \
--type String \
--region "ap-northeast-3"
Authentication to heroku is done by writing email
and token
in the .netrc
file as written in the Heroku CLI Authentication.You can get your token from here. And you need to set your app name to app
input.
You can perform this action whenever you like. Push is fine, and PR comments are also fine.
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-3
- name: Sets Heroku environment
uses: iisyos/[email protected]
with:
path: ${{ secrets.PARAMETER_STORE_PATH }}
email: ${{ secrets.HEROKU_EMAIL }}
token: ${{ secrets.HEROKU_TOKEN }}
app: ${{ secrets.HEROKU_APP_NAME }}