Skip to content

Commit

Permalink
Remove APP_ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
dgcohen committed Sep 10, 2024
1 parent 6bdb83a commit 49418ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/deploy_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ permissions:
env:
AWS_DEFAULT_REGION: us-east-1
LOCAL_TAG_NAME: research-catalog:${{ github.ref_name }}-${{ github.run_number }}
APP_ENV: production

jobs:
deploy:
Expand All @@ -34,15 +33,15 @@ jobs:

- name: Build and push Docker image to Amazon ECR
env:
ECR_URL: 946183545209.dkr.ecr.us-east-1.amazonaws.com/research-catalog:$APP_ENV-latest
MANIFEST: $(aws ecr batch-get-image --repository-name research-catalog --image-ids imageTag="$APP_ENV-latest" --output json | jq --raw-output --join-output '.images[0].imageManifest')
ECR_URL: 946183545209.dkr.ecr.us-east-1.amazonaws.com/research-catalog:production-latest
MANIFEST: $(aws ecr batch-get-image --repository-name research-catalog --image-ids imageTag="production-latest" --output json | jq --raw-output --join-output '.images[0].imageManifest')
run: |
docker build --build-arg NEXT_PUBLIC_APP_ENV=$APP_ENV --tag $LOCAL_TAG_NAME .
docker build --build-arg NEXT_PUBLIC_APP_ENV=production --tag $LOCAL_TAG_NAME .
docker tag $LOCAL_TAG_NAME $ECR_URL
aws ecr batch-delete-image --repository-name research-catalog --image-ids imageTag="$APP_ENV-previous" || true
aws ecr put-image --repository-name research-catalog --image-tag "$APP_ENV-previous" --image-manifest "$MANIFEST" || true
aws ecr batch-delete-image --repository-name research-catalog --image-ids imageTag="production-previous" || true
aws ecr put-image --repository-name research-catalog --image-tag "production-previous" --image-manifest "$MANIFEST" || true
docker push $ECR_URL
- name: Update ECS service
run: |
aws ecs update-service --cluster research-catalog-$APP_ENV --service research-catalog-$APP_ENV --force-new-deployment
aws ecs update-service --cluster research-catalog-production --service research-catalog-production --force-new-deployment
13 changes: 6 additions & 7 deletions .github/workflows/deploy_qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ env:
AWS_DEFAULT_REGION: us-east-1
# LOCAL_TAG_NAME: research-catalog:${{ github.ref_name }}-${{ github.run_number }}
LOCAL_TAG_NAME: research-catalog:test-${{ github.run_number }}
APP_ENV: qa

jobs:
deploy:
Expand All @@ -36,16 +35,16 @@ jobs:

- name: Build and push Docker image to Amazon ECR
env:
ECR_URL: 946183545209.dkr.ecr.us-east-1.amazonaws.com/research-catalog:$APP_ENV-latest
MANIFEST: $(aws ecr batch-get-image --repository-name research-catalog --image-ids imageTag="$APP_ENV-latest" --output json | jq --raw-output --join-output '.images[0].imageManifest')
ECR_URL: 946183545209.dkr.ecr.us-east-1.amazonaws.com/research-catalog:qa-latest
MANIFEST: $(aws ecr batch-get-image --repository-name research-catalog --image-ids imageTag="qa-latest" --output json | jq --raw-output --join-output '.images[0].imageManifest')

run: |
docker build --build-arg NEXT_PUBLIC_APP_ENV=$APP_ENV --tag $LOCAL_TAG_NAME .
docker build --build-arg NEXT_PUBLIC_APP_ENV=qa --tag $LOCAL_TAG_NAME .
docker tag $LOCAL_TAG_NAME $ECR_URL
aws ecr batch-delete-image --repository-name research-catalog --image-ids imageTag="$APP_ENV-previous" || true
aws ecr put-image --repository-name research-catalog --image-tag "$APP_ENV-previous" --image-manifest "$MANIFEST" || true
aws ecr batch-delete-image --repository-name research-catalog --image-ids imageTag="qa-previous" || true
aws ecr put-image --repository-name research-catalog --image-tag "qa-previous" --image-manifest "$MANIFEST" || true
# docker push $ECR_URL
# - name: Update ECS service
# run: |
# aws ecs update-service --cluster research-catalog-$APP_ENV --service research-catalog-$APP_ENV --force-new-deployment
# aws ecs update-service --cluster research-catalog-qa --service research-catalog-qa --force-new-deployment

0 comments on commit 49418ae

Please sign in to comment.