Skip to content

deploy: #114 - Deploy log 경로 수정 #4

deploy: #114 - Deploy log 경로 수정

deploy: #114 - Deploy log 경로 수정 #4

name: Java CI with Gradle
on:
push:
branches: [ "deploy/#114" ]
env:
S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME_DEV }}
CODE_DEPLOY_APPLICATION_NAME: dodal-code-deploy
CODE_DEPLOY_DEPLOYMENT_GROUP: deploy
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: make application-dev.yml
run: |
cd ./src/main/resources
touch ./application-dev.yml
echo "${{ secrets.APPLICATION_DEV }}" > ./application-dev.yml
touch ./application.yml
echo "${{ secrets.APPLICATION_YML }}" > ./application.yml
cd ../../test/resources
touch ./application.yml
echo "${{ secrets.APPLICATION_YML }}" > ./application.yml
- name: create-json
id: create-json
uses: jsdaniell/[email protected]
with:
name: "dodal-fcm.json"
json: ${{ secrets.FCM_JSON }}
dir: src/main/resources
- name: Build with Gradle
run: |
./gradlew cleanQuerydslSourceDir
./gradlew build
# 전송할 JAR 파일을 담을 디렉토리 생성
- name: Make Directory for deliver
run: mkdir ./deploy
- name: Copy Jar
run: |
chmod +x ./build/libs/*.jar
cp ./build/libs/*.jar ./deploy/
cp ./appspec.yml ./deploy/
cp -r ./scripts ./deploy/
# 압축파일 형태로 전달
- name: Make zip file
run: |
cd ./deploy
zip -r ./deploy-dev.zip .
# S3 Bucket으로 copy
- name: Deliver to AWS S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_DEV }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_KEY_DEV }}
run: |
aws s3 cp \
--region ap-northeast-2 \
--acl private ./deploy/deploy-dev.zip s3://${{ env.S3_BUCKET_NAME }}/deploy/deploy-dev.zip
# CodeDeploy
- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CODE_DEPLOY_ACCESS_KEY_DEV }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CODE_DEPLOY_SECRET_KEY_DEV }}
run: |
aws deploy create-deployment \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP }} \
--file-exists-behavior OVERWRITE \
--ignore-application-stop-failures \
--s3-location bucket=${{ env.S3_BUCKET_NAME }},bundleType=zip,key=deploy/deploy-dev.zip \
--region ap-northeast-2