Skip to content

Commit

Permalink
Adding env variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
sshrihar committed Sep 23, 2024
1 parent 6d76c55 commit 0ceb85a
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,19 @@ on:

jobs:
build_site_data:
name: ${{ inputs.environment }} deployment
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
permissions:
id-token: write
contents: write
env:
AWS_REGION: ${{ inputs.region }}
ECR_REPOSITORY: ${{ inputs.core_app }}-${{ inputs.environment }}-ecr
ECS_SERVICE: ${{ inputs.core_app }}-${{ inputs.environment }}-ecs-service
ECS_CLUSTER: frontend-${{ inputs.environment }}-ecs-cluster
ECS_TASK_DEFINITION: ${{ inputs.task_definition }}
APP_NAME: ${{ inputs.core_app }}-${{ inputs.environment }}
steps:
- name: Checkout Code Repository
uses: actions/checkout@v3
Expand All @@ -47,8 +55,8 @@ jobs:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ inputs.region }}
role-to-assume: arn:aws:iam::${{ inputs.account_number }}:role/${{ inputs.core_app }}-${{ inputs.environment }}-GithubActionsRole
aws-region: ${{ env.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ inputs.account_number }}:role/${{ env.APP_NAME }}-GithubActionsRole
role-session-name: GithubActionsSession

- uses: actions/setup-python@v4
Expand Down Expand Up @@ -84,7 +92,7 @@ jobs:
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}-${{ github.run_number }}
ECR_REPOSITORY: ${{ inputs.core_app }}-${{ inputs.environment }}-ecr
ECR_REPOSITORY: ${{ env.APP_NAME }}-ecr
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile.review .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
Expand All @@ -94,21 +102,21 @@ jobs:
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ${{ inputs.task_definition }}
container-name: ${{ inputs.core_app }}-${{ inputs.environment }}
task-definition: ${{ env.ECS_TASK_DEFINITION }}
container-name: ${{ env.APP_NAME }}
image: ${{ steps.build-image.outputs.image }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ inputs.core_app }}-${{ inputs.environment }}-ecs-service
cluster: ${{ inputs.cluster_name }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true

- name: Cloudflare Cache Purge
uses: nathanvaughn/actions-cloudflare-purge@master
with:
cf_zone: ${{ secrets.CLOUDFLARE_ZONE }}
cf_auth: ${{ secrets.CLOUDFLARE_AUTH_KEY }}
hosts: ${{ inputs.core_app }}-${{ inputs.environment }}.polygon.technology
hosts: ${{ env.APP_NAME }}.polygon.technology

0 comments on commit 0ceb85a

Please sign in to comment.