Skip to content

Commit

Permalink
github workflows: add step to sync .env files to s3
Browse files Browse the repository at this point in the history
  • Loading branch information
digorgonzola committed Dec 20, 2023
1 parent 6d6598b commit 88d1a45
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/deploy-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}

- name: Push container environment file to S3
run: aws s3 sync . $bucket_path --include "$include.env"
working-directory: ./deploy/container
env:
bucket_path: ${{ vars.CONFIG_BUCKET_PATH }}
include: ${{ vars.ENVIRONMENT }}

- name: Expose github variables to shell as environment variables
env:
VARS_CONTEXT: ${{ toJson(vars) }}
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}

- name: Push container environment file to S3
run: aws s3 sync . $bucket_path --include "$include.env"
working-directory: ./deploy/container
env:
bucket_path: ${{ vars.CONFIG_BUCKET_PATH }}
include: ${{ vars.ENVIRONMENT }}

- name: Expose github environment as shell variables
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}
Expand All @@ -116,7 +123,7 @@ jobs:
TF_INPUT: 0
TF_IN_AUTOMATION: true
# get the image digest from the build job with optional override from vars context
TF_VAR_image: ${{ vars.IMAGE || needs.build_push.outputs.image_digest }}
TF_VAR_image: ${{ needs.build_push.outputs.image_digest }}

- name: Terragrunt Apply
uses: gruntwork-io/terragrunt-action@v2
Expand All @@ -129,4 +136,4 @@ jobs:
TF_INPUT: 0
TF_IN_AUTOMATION: true
# get the image digest from the build job with optional override from vars context
TF_VAR_image: ${{ vars.IMAGE || needs.build_push.outputs.image_digest }}
TF_VAR_image: ${{ needs.build_push.outputs.image_digest }}
11 changes: 9 additions & 2 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}

- name: Push container environment file to S3
run: aws s3 sync . $bucket_path --include "$include.env"
working-directory: ./deploy/container
env:
bucket_path: ${{ vars.CONFIG_BUCKET_PATH }}
include: ${{ vars.ENVIRONMENT }}

- name: Expose github environment as shell variables
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}
Expand All @@ -98,7 +105,7 @@ jobs:
TF_INPUT: 0
TF_IN_AUTOMATION: true
# get the image digest from the build job with optional override from vars context
TF_VAR_image: ${{ vars.IMAGE || needs.build_push.outputs.image_digest }}
TF_VAR_image: ${{ needs.build_push.outputs.image_digest }}

- name: Terragrunt Apply
uses: gruntwork-io/terragrunt-action@v2
Expand All @@ -111,4 +118,4 @@ jobs:
TF_INPUT: 0
TF_IN_AUTOMATION: true
# get the image digest from the build job with optional override from vars context
TF_VAR_image: ${{ vars.IMAGE || needs.build_push.outputs.image_digest }}
TF_VAR_image: ${{ needs.build_push.outputs.image_digest }}

0 comments on commit 88d1a45

Please sign in to comment.