Skip to content

Commit

Permalink
�chore: CI/CD를 위한 스크립트 파일 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kitaee authored Jan 6, 2025
1 parent d35de80 commit ed89463
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CD with Gradle

on:
push:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: "adopt"

- name: Make application.yml
run: |
cd ./src/main/resources
touch ./application.yml
echo "${{ secrets.DATABASE }}" > ./application.yml
shell: bash

- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew clean build -x test
- name: Docker build & push to docker repo
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile -t ${{ secrets.DOCKER_REPO }}/directors-dev .
docker push ${{ secrets.DOCKER_REPO }}/directors-dev
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
sudo docker rm -f $(docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_REPO }}/directors-dev
docker-compose up -d
docker image prune -f

0 comments on commit ed89463

Please sign in to comment.