Skip to content

Commit

Permalink
fix(cd): synchronized to staging env
Browse files Browse the repository at this point in the history
  • Loading branch information
astorverse committed Jul 23, 2024
1 parent 47aa805 commit 3fdfa4f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy-to-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy to Production
on:
push:
branches:
- master
- staging

jobs:
build_and_push:
Expand All @@ -15,7 +15,7 @@ jobs:
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_STAGING_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_STAGING_SECRET_ACCESS_KEY }}
AWS_PROFILE: production
AWS_PROFILE: staging
ACCOUNT: 'ubuntu'
DOCKER_TAG: 'latest'
SERVICE_NAME: 'blccu'
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_STAGING_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_STAGING_SECRET_ACCESS_KEY }}
AWS_PROFILE: production
AWS_PROFILE: staging
ACCOUNT: 'ubuntu'
DOCKER_TAG: 'latest'
SERVICE_NAME: 'blccu'
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
ssh -i deploy_key.pem $SERVER "aws ecr get-login-password --region ${{ env.AWS_DEFAULT_REGION }} | docker login --username AWS --password-stdin ${{ env.ECR_URL }}"
ssh -i deploy_key.pem $SERVER "docker pull ${{ env.ECR_URL }}/${{ env.SERVICE_NAME }}:${{ env.DOCKER_TAG }}"
ssh -i deploy_key.pem $SERVER "docker run --env-file /home/${{ env.ACCOUNT }}/upload/.env.prod -d -p $NEW_PORT:3000 --name $NEW_SERVICE_NAME -e TZ=Asia/Seoul ${{ env.ECR_URL }}/${{ env.SERVICE_NAME }}:${{ env.DOCKER_TAG }}"
ssh -i deploy_key.pem $SERVER "docker run --env-file /home/${{ env.ACCOUNT }}/upload/.env.staging -d -p $NEW_PORT:3000 --name $NEW_SERVICE_NAME -e TZ=Asia/Seoul ${{ env.ECR_URL }}/${{ env.SERVICE_NAME }}:${{ env.DOCKER_TAG }}"
for i in {1..20}; do
HEALTH_CHECK=$(ssh -i deploy_key.pem $SERVER "curl -v -s -o /dev/null -w '%{http_code}' http://localhost:$NEW_PORT/health || true")
Expand Down

0 comments on commit 3fdfa4f

Please sign in to comment.