Skip to content

cicd: 서브모듈 수정 #125

cicd: 서브모듈 수정

cicd: 서브모듈 수정 #125

Workflow file for this run

name: Backend CD
on:
push:
branches:
- develop
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@master
with:
token: ${{ secrets.ACTION_TOKEN }}
submodules: true
- name: Update submodules
run: git submodule update --remote
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
- 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-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew :core:core-api:build
- name: Make zip file
run: |
mkdir deploy
cp ./docker/docker-compose.yml ./deploy/
cp ./appspec.yml ./deploy/
cp ./scripts/deploy.sh ./deploy/
cp ./docker/Dockerfile ./deploy/
cp ./core/core-api/build/libs/*.jar ./deploy/
zip -r -qq -j ./spring-build.zip ./deploy
- 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
- name: Upload to S3
run: |
aws s3 cp \
--region ap-northeast-2 \
./spring-build.zip s3://melly-s3
- name: Code Deploy
run: aws deploy create-deployment --application-name melly-deploy
--deployment-config-name CodeDeployDefault.HalfAtATime
--deployment-group-name melly-deploy-group
--s3-location bucket=melly-s3,bundleType=zip,key=spring-build.zip
- name: Send Slack Message
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: melly_deploy_bot
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
mention: here
if_mention: failure, cancelled
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()