Skip to content

Commit

Permalink
actions fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbass committed May 9, 2024
1 parent d62ac02 commit 8a6b29e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ jobs:
deploy-iac:
needs: detect-changes
runs-on: ubuntu-latest
environment: production
if: needs.detect-changes.outputs.deploy-iac == 'true'
environment: production
runs-on: ubuntu-latest
env:
TF_VAR_region: ${{ vars.AWS_REGION }}
TF_VAR_environment: ${{ vars.ENV_SHORT_NAME }}
Expand Down Expand Up @@ -118,10 +118,12 @@ jobs:
terragrunt apply tfplan
deploy-frontend:
needs: detect-changes
runs-on: ubuntu-latest
environment: production
needs:
- detect-changes
- deploy-iac
if: needs.detect-changes.outputs.deploy-frontend == 'true'
environment: production
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -135,7 +137,7 @@ jobs:

- name: Build project
run: |
cp frontend/.env.${{ vars.APP_ENV }}.example frontend/.env.${{ vars.APP_ENV }}
cp frontend/.env.prod.example frontend/.env.prod
cd frontend && yarn build --mode ${{ vars.APP_ENV }}
- name: Configure AWS credentials
Expand All @@ -145,11 +147,13 @@ jobs:
role-session-name: Appointment_GitHub_to_AWS_via_FederatedOIDC
aws-region: ${{ vars.AWS_REGION }}

deploy-backend:
needs: detect-changes
runs-on: ubuntu-latest
environment: production
deploy-backend-service:
needs:
- detect-changes
- deploy-iac
if: needs.detect-changes.outputs.deploy-backend == 'true'
environment: production
runs-on: ubuntu-latest
env:
TF_VAR_region: ${{ vars.AWS_REGION }}
TF_VAR_environment: ${{ vars.ENV_SHORT_NAME }}
Expand Down Expand Up @@ -195,7 +199,7 @@ jobs:
- name: Build, tag, and push backend image to Amazon ECR
id: build-backend
env:
ECR_TAG: '${{ steps.login-ecr.outputs.registry }}/$${{ vars.PROJECT }}:backend-${{ github.sha }}'
ECR_TAG: '${{ steps.login-ecr.outputs.registry }}/${{ vars.PROJECT }}:backend-${{ github.sha }}'
run: |
# Build a docker container and
# push it to ECR so that it can
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
deploy-iac:
needs: detect-changes
runs-on: ubuntu-latest
environment: staging
if: needs.detect-changes.outputs.deploy-iac == 'true'
environment: staging
runs-on: ubuntu-latest
env:
TF_VAR_region: ${{ vars.AWS_REGION }}
TF_VAR_environment: ${{ vars.ENV_SHORT_NAME }}
Expand Down Expand Up @@ -121,10 +121,12 @@ jobs:
terragrunt apply tfplan
deploy-frontend:
needs: detect-changes
runs-on: ubuntu-latest
environment: staging
needs:
- detect-changes
- deploy-iac
if: needs.detect-changes.outputs.deploy-frontend == 'true'
environment: staging
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -138,7 +140,7 @@ jobs:

- name: Build project
run: |
cp frontend/.env.${{ vars.APP_ENV }}.example frontend/.env.${{ vars.APP_ENV }}
cp frontend/.env.staging.example frontend/.env.staging
cd frontend && yarn build --mode ${{ vars.APP_ENV }}
- name: Configure AWS credentials
Expand All @@ -148,11 +150,13 @@ jobs:
role-session-name: Appointment_GitHub_to_AWS_via_FederatedOIDC
aws-region: ${{ vars.AWS_REGION }}

deploy-backend:
needs: detect-changes
runs-on: ubuntu-latest
environment: staging
deploy-backend-service:
needs:
- detect-changes
- deploy-iac
if: needs.detect-changes.outputs.deploy-backend == 'true'
environment: staging
runs-on: ubuntu-latest
env:
TF_VAR_region: ${{ vars.AWS_REGION }}
TF_VAR_environment: ${{ vars.ENV_SHORT_NAME }}
Expand Down Expand Up @@ -198,7 +202,7 @@ jobs:
- name: Build, tag, and push backend image to Amazon ECR
id: build-backend
env:
ECR_TAG: '${{ steps.login-ecr.outputs.registry }}/$${{ vars.PROJECT }}:backend-${{ github.sha }}'
ECR_TAG: '${{ steps.login-ecr.outputs.registry }}/${{ vars.PROJECT }}:backend-${{ github.sha }}'
run: |
# Build a docker container and
# push it to ECR so that it can
Expand Down

0 comments on commit 8a6b29e

Please sign in to comment.