Merge pull request #96 from SWM-M3PRO/develop #17
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: Backend Prod Server CD | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: JDK 17 설치 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: env 설정 | |
run: | | |
echo "DB_URI=${{ secrets.DB_URI_PROD }}" >> .env | |
echo "DB_USERNAME=${{ secrets.DB_USERNAME_PROD }}" >> .env | |
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD_PROD }}" >> .env | |
echo "SPRING_PROFILES_ACTIVE=prod" >> .env | |
echo "X-NCP-APIGW-API-KEY-ID=${{ secrets.NAVER_APIKEYID }}" >> .env | |
echo "X-NCP-APIGW-API-KEY=${{ secrets.NAVER_APIKEY }}" >> .env | |
echo "JWT_SECRET_KEY=${{ secrets.JWT_SECRET_KEY_PROD }}" >> .env | |
echo "KAKAO_APP_ID=${{ secrets.KAKAO_APP_ID }}" >> .env | |
echo "REDIS_HOST=${{ secrets.REDIS_HOST_PROD }}" >> .env | |
echo "AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY_PROD }}" >> .env | |
echo "AWS_SECRET_KEY=${{ secrets.AWS_SECRET_KEY_PROD }}" >> .env | |
echo "AWS_S3_BUCKET=${{ secrets.AWS_S3_BUCKET_PROD }}" >> .env | |
echo "APPLE_APP_ID=${{ secrets.APPLE_APP_ID }}" >> .env | |
echo "APPLE_TEAM_ID=${{ secrets.APPLE_TEAM_ID }}" >> .env | |
echo "APPLE_KEY_ID=${{ secrets.APPLE_KEY_ID }}" >> .env | |
echo "APPLE_PRIVATE_KEY=${{ secrets.APPLE_PRIVATE_KEY }}" >> .env | |
echo "LATEST_VERSION=${{ secrets.LATEST_VERSION_PROD }}" >> .env | |
echo "FORCE_UPDATE_VERSION=${{ secrets.FORCE_UPDATE_VERSION_PROD }}" >> .env | |
echo "GEOCODING_API=${{ secrets.GEOCODING_API }}" >> .env | |
- name: gradlew에 실행 권한 부여 | |
run: chmod +x ./gradlew | |
- name: 프로젝트 빌드 | |
run: ./gradlew clean bootjar -x test | |
- name: 압축 | |
run: zip -r ./ground_flip.zip . | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_PROD }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_PROD }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: S3에 업로드 | |
run: aws s3 cp ground_flip.zip s3://ground-flip-prod-cicd/deploy/ground_flip.zip --region ap-northeast-2 | |
- name: Code Deploy 로 배포 | |
run: > | |
aws deploy create-deployment --application-name ground-flip-prod | |
--deployment-config-name CodeDeployDefault.AllAtOnce | |
--deployment-group-name ground_flip_prod | |
--s3-location bucket=ground-flip-prod-cicd,bundleType=zip,key=deploy/ground_flip.zip |