Skip to content

Commit

Permalink
dynamic frontend bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbass committed May 13, 2024
1 parent b93c9e4 commit 47a6035
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
if: needs.detect-changes.outputs.deploy-iac == 'true'
environment: production
runs-on: ubuntu-latest
outputs:
bucket: ${{ steps.output-bucket-name.outputs.bucket }}
env:
TF_VAR_region: ${{ vars.AWS_REGION }}
TF_VAR_environment: ${{ vars.ENV_SHORT_NAME }}
Expand Down Expand Up @@ -117,6 +119,13 @@ jobs:
terragrunt plan -out tfplan
terragrunt apply tfplan
- name: output-bucket-name
id: output-bucket-name
working-directory: ./tofu/environments/stage/services/frontend-infra
run: |
output=$(terragrunt output bucket | tr -d '"')
echo bucket=$output >> $GITHUB_OUTPUT
deploy-frontend:
needs:
- detect-changes
Expand Down Expand Up @@ -154,7 +163,7 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}

- name: Deploy frontend to S3
run: aws s3 sync frontend/dist s3://tb-apmt-prod-frontend
run: aws s3 sync frontend/dist "s3://${{ needs.deploy-iac.outputs.bucket }}" //s3://tb-apmt-prod-frontend

deploy-backend:
needs:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ jobs:
terragrunt plan -out tfplan
terragrunt apply tfplan
- name: output-bucket-name
id: output-bucket-name
working-directory: ./tofu/environments/stage/services/frontend-infra
run: |
output=$(terragrunt output bucket | tr -d '"')
echo bucket=$output >> $GITHUB_OUTPUT
deploy-frontend:
needs:
- detect-changes
Expand Down Expand Up @@ -158,7 +165,7 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}

- name: Deploy frontend to S3
run: aws s3 sync frontend/dist s3://tb-apmt-stg-frontend
run: aws s3 sync frontend/dist "s3://${{ needs.deploy-iac.outputs.bucket }}" //s3://tb-apmt-stg-frontend



Expand Down

0 comments on commit 47a6035

Please sign in to comment.