Skip to content

Merge pull request #122 from soma-baekgu/feature/BG-250-notification-… #29

Merge pull request #122 from soma-baekgu/feature/BG-250-notification-…

Merge pull request #122 from soma-baekgu/feature/BG-250-notification-… #29

name: 'CI/CD DEVELOP'
on:
push:
branches:
- 'develop'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Cache Gradle packages
uses: actions/[email protected]
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: make application.yml
run: |
cd ./api/src/main/resources/
touch ./application.yaml
echo "${{ secrets.YAML_DEV }}" > ./application.yaml
shell: bash
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build -x test
- name: Docker build & Push
run: |
docker login -u ${{ secrets.DOCKER_ID }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_ID }}/backgu:dev .
docker push ${{ secrets.DOCKER_ID }}/backgu:dev
- name: Deploy Images with Docker compose
uses: appleboy/[email protected]
env:
APP: "backgu-dev"
COMPOSE: "/home/ec2-user/compose/docker-compose-dev.yaml"
with:
host: ${{secrets.EC2_DEV_HOST}}
username: ec2-user
key: ${{secrets.EC2_DEV_PRIVATE_KEY}}
port: 22
envs: APP, COMPOSE
script_stop: true
script: |
docker-compose -f $COMPOSE down
docker pull ${{ secrets.DOCKER_ID }}/backgu:dev
docker-compose -f $COMPOSE up -d