[Feature] 이동봉사자 후기 등록 검증 및 테스트 코드 수정 #192
Workflow file for this run
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: connectdog CICD(deploy) | |
on: | |
push: | |
branches: [ "develop" ] | |
pull_request: | |
branches: [ "develop" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
# JDK를 17 버전으로 세팅 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# Gradle 캐싱-> 빌드 속도 UP | |
- name: Gradle caching | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
# application-jwt.yml 파일 생성 | |
- name: make application-jwt.yml | |
run: | | |
cd ./src/main/resources | |
touch ./application-jwt.yml | |
echo "${{ secrets.APPLICATION_JWT_YML }}" > ./application-jwt.yml | |
shell: bash | |
# application-dev.yml 파일 생성 | |
- name: make application-dev.yml | |
run: | | |
cd ./src/main/resources | |
touch ./application-dev.yml | |
echo "${{ secrets.APPLICATION_DEV_YML }}" > ./application-dev.yml | |
shell: bash | |
# firebase-key.json 생성 | |
- name: create firebase-key.json | |
run: | | |
cd ./src/main/resources | |
touch ./firebase-key.json | |
echo "${{ secrets.FCM }}" | base64 --decode > ./firebase-key.json | |
ls -la | |
shell: bash | |
# ./gradlew 권한 설정 | |
- name: ./gradlew 권한 설정 | |
run: chmod +x ./gradlew | |
# Gradle build (Test 제외) | |
- name: Build with Gradle | |
run: ./gradlew build -x test | |
# AWS에 연결 | |
- name: Connect to AWS | |
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 | |
# 빌드파일을 ZIP 파일로 생성 | |
- name: Make zip file | |
run: | | |
mkdir deploy | |
cp ./docker-compose.blue.yml ./deploy/ | |
cp ./docker-compose.green.yml ./deploy/ | |
cp ./appspec.yml ./deploy/ | |
cp ./Dockerfile ./deploy/ | |
cp ./scripts/deploy.sh ./deploy/ | |
cp ./build/libs/*.jar ./deploy/ | |
zip -r -qq -j ./connectdog-build.zip ./deploy | |
# S3에 zip 파일 업로드 | |
- name: Upload to S3 | |
run: | | |
aws s3 cp \ | |
--region ap-northeast-2 \ | |
./connectdog-build.zip s3://connectdog-bucket | |
# CodeDeploy에 배포 요청 | |
- name: Code Deploy Deployment Request | |
run: | | |
aws deploy create-deployment --application-name ConnectDog \ | |
--deployment-config-name CodeDeployDefault.OneAtATime \ | |
--deployment-group-name ConnectDog \ | |
--s3-location bucket=connectdog-bucket,bundleType=zip,key=connectdog-build.zip |