Skip to content

Update README.md

Update README.md #105

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
java-version: '21'
distribution: 'temurin'
- name: Gradle Permission
run: chmod +x ./gradlew
- name: Gradle Setup
uses: gradle/actions/setup-gradle@v3
- name: make application.yml
run: |
cd ./src/main/resources
touch ./application.yml
echo "${{ secrets.APP_SET }}" > ./application.yml
shell: bash
- name: AWS credentials μ„€μ •
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-northeast-2
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRETE_ACCESS_KEY }}
- name: Download JAR from S3
run: |
mkdir -p ./src/main/resources/lib
aws s3 cp s3://salesboost-font/font-extension.jar ./src/main/resources/lib/font-extension.jar
- name: Gradle Build
run: ./gradlew clean build -x test
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Docker Build & Push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ secrets.DOCKER_HUB_IMAGE }}
deploy:
needs: build
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
steps:
- name: Deploy to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.AWS_EC2_HOST }}
username: ${{ secrets.AWS_EC2_USER }}
key: ${{ secrets.AWS_SSH_PRIVATE_KEY }}
script: |
cd /home/ubuntu/salesboost
docker-compose down || echo "skip remove"
docker-compose pull
docker-compose -f ./docker-compose.yml up -d
docker image prune -a -f || echo "skip remove"
notify-discord:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Push success
if: success()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{"content":"🟒 **Backend CI/CD Pipeline Success**"}' \
${{ secrets.DISCORD_WEBHOOK_URL }}
- name: Push fail
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{"content":"πŸ”΄ **Backend CI/CD Pipeline Fail**"}' \
${{ secrets.DISCORD_WEBHOOK_URL }}