Merge pull request #31 from catchroom/develop #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
on: | |
push: | |
branches: | |
- main | |
env: | |
CODE_DEPLOY_APPLICATION_NAME: CatchRoom-deploy | |
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: CatchRoom-Codedeployment | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: 'adopt' # or 'temurin' or 'zulu' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew build | |
# 전송할 파일을 담을 디렉토리 생성 | |
- name: Make Directory for deliver | |
run: mkdir deploy | |
# Jar 파일 copy | |
- name: Copy Jar | |
run: cp ./build/libs/*.jar ./deploy/ | |
- name: Copy appspec and deploy script | |
run: | | |
cp ./appspec.yml ./deploy/ | |
cp ./deploy.sh ./deploy/ | |
# 압축파일 형태로 전달 | |
- name: Make zip file | |
run: zip -r -qq -j ./$GITHUB_SHA.zip ./deploy | |
# S3 Bucket으로 Upload | |
- name: Deploy | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | |
aws-region: ap-northeast-2 | |
# S3 Bucket으로 copy | |
- name: Deliver to AWS S3 | |
run: aws s3 cp --region ap-northeast-2 --acl private ./$GITHUB_SHA.zip s3://catchroom-bucket/ | |
- name: Code Deploy | |
run: | | |
aws deploy create-deployment \ | |
--deployment-config-name CodeDeployDefault.AllAtOnce \ | |
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \ | |
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \ | |
--s3-location bucket=catchroom-bucket,bundleType=zip,key=$GITHUB_SHA.zip |