feat: 배포 테스트용도로 push branch 임시 변경 #61 #32
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: Develop Branch CI | |
on: | |
push: | |
branches: [ "feat/#61" ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# JDK 설정 | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
# 환경 변수 파일 생성 | |
- name: Set environment values for common | |
run: | | |
cd ./src/main/resources | |
touch ./env-common.properties | |
echo "${{ secrets.ENV_COMMON }}" > ./env-common.properties | |
shell: bash | |
- name: Set environment values for prod | |
run: | | |
cd ./src/main/resources | |
touch ./env-prod.properties | |
echo "${{ secrets.ENV_PROD }}" > ./env-prod.properties | |
shell: bash | |
- name: Set environment values for test | |
run: | | |
cd ./src/test/resources | |
touch ./env-test.properties | |
echo "${{ secrets.TEST_ENV }}" > ./env-test.properties | |
shell: bash | |
# Gradle에 권한 부여 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
# Gradle test | |
- name: Test with Gradle | |
run: ./gradlew test | |
# Gradle build | |
- name: Build Gradle | |
run: ./gradlew build | |
# 압축 파일 만들기 | |
- name: Make zip file | |
run: | | |
mkdir develop-deploy | |
cp ./src/main/resources/env-common.properties ./develop-deploy/.env.common | |
cp ./src/main/resources/env-prod.properties ./develop-deploy/.env.prod | |
cp ./docker-compose.blue.yml ./develop-deploy/ | |
cp ./docker-compose.green.yml ./develop-deploy/ | |
cp ./appspec.yml ./develop-deploy/ | |
cp ./Dockerfile ./develop-deploy/ | |
cp ./scripts/*.sh ./develop-deploy/ | |
cp ./build/libs/*.jar ./develop-deploy/ | |
zip -r -qq -j ./munecting.zip ./develop-deploy | |
# AWS 접속 | |
- 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 | |
# S3에 저장 | |
- name: Upload to S3 | |
run: aws s3 cp --region ap-northeast-2 ./munecting.zip s3://code-deploy-munecting | |
# Code Deploy 실행 | |
- name: Code Deploy | |
run: aws deploy create-deployment --application-name munecting-deploy | |
--deployment-config-name CodeDeployDefault.OneAtATime | |
--deployment-group-name munecting-deploy-group | |
--s3-location bucket=code-deploy-munecting,bundleType=zip,key=munecting.zip |