Skip to content

Merge pull request #233 from softeerbootcamp-2nd/be-develop #16

Merge pull request #233 from softeerbootcamp-2nd/be-develop

Merge pull request #233 from softeerbootcamp-2nd/be-develop #16

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: MyCarDeepDive CI/CD
on:
push:
branches:
- be-main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: checkout release
uses: actions/checkout@v3
- name: Setup JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Configure AWS
id: 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: ${{ secrets.AWS_REGION }}
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Gradle Build
run: ./gradlew build
shell: bash
- name: Jacoco Report
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: jacoco-report
path: build/reports/jacoco/test/html
- name: DockerHub Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Docker Build
run: docker build --build-arg 'PROFILE=prod' -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_PROD_REPOSITORY }}:${{ secrets.DOCKER_TAG }} .
- name: Docker Push
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_PROD_REPOSITORY }}:${{ secrets.DOCKER_TAG }}
- name: Make zip file
run: zip -r scripts.zip scripts-prod/
shell: bash
- name: Upload to S3
run: aws s3 cp --region ${{ secrets.AWS_REGION }} scripts.zip s3://${{ secrets.S3_BUCKET_PROD_NAME }}/script/
- name: Code Deploy
run: aws deploy create-deployment --application-name ${{ secrets.CODEDEPLOY_PROD_NAME }} --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name ${{ secrets.CODEDEPLOY_PROD_GROUP }} --s3-location bucket=${{ secrets.S3_BUCKET_PROD_NAME }},bundleType=zip,key=script/scripts.zip
- name: action-slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: mycardeepdive-be
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
if_mention: failure,cancelled
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()