Skip to content

Merge pull request #80 from CAPSTON-EIGHT/gpt/yeni #60

Merge pull request #80 from CAPSTON-EIGHT/gpt/yeni

Merge pull request #80 from CAPSTON-EIGHT/gpt/yeni #60

Workflow file for this run

name: ArtHunter server CI/CD
# Controls when the workflow will run
on:
push:
branches:
- release
pull_request:
types:
- closed
branches:
- release
env:
S3_BUCKET_NAME: cointalk-deploy
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
env:
GOOGLE_CLIENT_ID: ${{secrets.GOOGLE_CLIENT_ID}}
GOOGLE_CLIENT_SECRET: ${{secrets.GOOGLE_CLIENT_SECRET}}
JWT_SECRET: ${{secrets.JWT_SECRET}}
DATABASE_USERNAME: ${{secrets.DATABASE_USERNAME}}
DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
DATABASE_URL: ${{secrets.DATABASE_URL}}
SERVICE_KEY: ${{secrets.SERVICE_KEY}}
REDIS_HOST: ${{secrets.REDIS_HOST}}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean build
# 빌드 성공하면 해당 프로젝트를 zip로 만듬
- name: Make zip file
run: |
mkdir deploy
cp ./build/libs/*.jar ./deploy/
zip -r -qq -j ./arthunter-build.zip ./deploy
# AWS 계정 설정
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
# Access key
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# Secret key
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Region
aws-region: ${{ secrets.AWS_REGION }}
# 만들어 놓은 S3에 해당 zip 파일 저장
- name: Upload to S3
run: |
aws s3 cp \
--region ap-northeast-2 \
./arthunter-build.zip s3://arthunter-s3-bucket
# codedeploy 실행해 배포
- name: Code Deploy
run: aws deploy create-deployment --application-name arthunter-codedeploy-app
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name arthunter-codedeploy-deployment-group
--s3-location bucket=arthunter-s3-bucket,bundleType=zip,key=arthunter-build.zip