1212 build :
1313 name : Deploy API specification
1414 runs-on : ubuntu-latest
15+ if : github.ref_name == 'dev'
1516 environment : ${{ github.ref_name }}
1617 steps :
1718 - name : Checkout repository
9596 host : ${{ secrets.EC2_HOST }}
9697 username : ${{ secrets.EC2_USER }}
9798 key : ${{ secrets.EC2_PRIVATE_KEY }}
98- source : docker/docker-compose.yml
99+ source : docker/docker-compose-${{ github.ref_name }} .yml
99100 target : " ~"
100101 strip_components : 1
101102 - name : Build and deploy container to AWS EC2
@@ -106,9 +107,12 @@ jobs:
106107 key : ${{ secrets.EC2_PRIVATE_KEY }}
107108 script : |
108109 aws secretsmanager get-secret-value --secret-id ${{ github.ref_name }}-env --region ap-northeast-2 --query SecretString --output text | jq -r '. | to_entries | map("\(.key)=\(.value)") | .[]' > .env
109- aws s3 cp s3://${{ secrets.API_SPECIFICATION_BUCKET }}/api.yml .
110110 export IMAGE_URI=${{ secrets.ECR_REGISTRY }}/${{ secrets.ECR_REPOSITORY }}:${{ github.sha }}
111- docker-compose --env-file .env up -d --build
111+ docker-compose -f docker-compose-${{ github.ref_name }}.yml --env-file .env up -d --build
112+ if [ "${{ github.ref_name }}" = "dev" ]; then
113+ aws s3 cp s3://${{ secrets.API_SPECIFICATION_BUCKET }}/api.yml .
114+ docker restart swagger
115+ fi
112116 notify-discord :
113117 name : Notify Discord
114118 runs-on : ubuntu-latest
@@ -127,7 +131,7 @@ jobs:
127131 "embeds": [
128132 {
129133 "title": "**${{ github.ref_name == 'prod' && '프로덕션' || '개발' }} 환경 배포 성공**",
130- "description": "프로젝트가 성공적으로 배포되었습니다.",
134+ "description": "서버가 성공적으로 배포되었습니다.",
131135 "color": 3066993,
132136 "fields": [
133137 {
0 commit comments