fix: 트랜잭션 전파 속성에 의한 동시성 문제 재발 해결 #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cd-dev | |
on: | |
pull_request: | |
branches: [ develop ] | |
types: [ closed ] | |
env: | |
AWS_REGION: ap-northeast-2 | |
S3_BUCKET_NAME: tago-deploy | |
CODE_DEPLOY_APPLICATION_NAME: tago-dev | |
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: tago-deploy-group | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Cache Gradle | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Create .env file | |
env: | |
ENV_PATH: .env | |
run: | | |
touch $ENV_PATH | |
echo DATABASE_URL=${{ secrets.DEV_DATABASE_URL }} >> $ENV_PATH | |
echo DATABASE_USERNAME=${{ secrets.DEV_DATABASE_USERNAME }} >> $ENV_PATH | |
echo DATABASE_PASSWORD=${{ secrets.DEV_DATABASE_PASSWORD }} >> $ENV_PATH | |
echo REDIS_HOST=${{ secrets.DEV_REDIS_HOST }} >> $ENV_PATH | |
echo REDIS_PORT=${{ secrets.DEV_REDIS_PORT }} >> $ENV_PATH | |
echo KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }} >> $ENV_PATH | |
echo JWT_SECRET_KEY=${{ secrets.JWT_SECRET_KEY }} >> $ENV_PATH | |
echo SLACK_BOT_TOKEN=${{ secrets.SLACK_BOT_TOKEN }} >> $ENV_PATH | |
echo NCLOUD_ACCESS_KEY=${{ secrets.NCLOUD_ACCESS_KEY }} >> $ENV_PATH | |
echo NCLOUD_SECRET_KEY=${{ secrets.NCLOUD_SECRET_KEY }} >> $ENV_PATH | |
echo NCLOUD_SMS_BASE_URL=${{ secrets.NCLOUD_SMS_BASE_URL }} >> $ENV_PATH | |
echo NCLOUD_SMS_CALLING_NUMBER=${{ secrets.NCLOUD_SMS_CALLING_NUMBER }} >> $ENV_PATH | |
echo NCLOUD_SMS_SERVICE_ID=${{ secrets.NCLOUD_SMS_SERVICE_ID }} >> $ENV_PATH | |
echo FCM_CERTIFICATION_PATH=${{ secrets.FCM_CERTIFICATION_PATH }} >> $ENV_PATH | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, tag, and push image to Amazon ECR | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: tago-dev | |
IMAGE_TAG: latest | |
run: | | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
- name: Upload to S3 | |
run: | | |
zip -r ./$GITHUB_SHA.zip ./scripts appspec.yml docker-compose.yml .env | |
aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME | |
- name: Deploy to EC2 with CodeDeploy | |
run: | | |
aws deploy create-deployment \ | |
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \ | |
--deployment-config-name CodeDeployDefault.AllAtOnce \ | |
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \ | |
--s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip |