This repository has been archived by the owner on Aug 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* util: build & deploy * fix: deploy를 main 브랜치 병합시에만 하도록 수정
- Loading branch information
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: CD | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
types: [closed] | ||
|
||
env: | ||
PROJECT: blue-delivery | ||
|
||
jobs: | ||
merge-PR: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.EC2_IP }} | ||
username: ${{ secrets.EC2_SSH_USERNAME }} | ||
key: ${{ secrets.EC2_SSH_KEY }} | ||
envs: env.PROJECT | ||
script: | | ||
cd ${{ env.PROJECT }} | ||
git pull | ||
cd techlab-compose | ||
docker-compose pull | ||
docker-compose up --force-recreate | ||
docker image prune -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: CI | ||
|
||
# workflow가 실행되는 시점 : 모든 브랜치에 대해 push 발생시 | ||
on: | ||
push: | ||
branches: | ||
- '*' | ||
|
||
# Actions 탭에서 수동 실행 가능 | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: # "bukld" 라는 하나의 job | ||
runs-on: ubuntu-latest # runner 타입 | ||
steps: | ||
# MySQL 데몬 | ||
- name: Setup MySQL | ||
uses: mirromutth/mysql-action@v1.1 | ||
with: | ||
host port: 3306 | ||
container port: 3306 | ||
character set server: 'utf8' | ||
collation server: 'utf8_general_ci' | ||
mysql version: '8.0' | ||
mysql database: 'delivery' | ||
mysql root password: ${{ secrets.MYSQL_ROOT_PASSWORD }} | ||
|
||
# 브랜치 체크아웃 | ||
- uses: actions/checkout@v2 | ||
|
||
# Cache workflow의 실행 시간을 개선하기 위해 의존성과 빌드 아웃풋을 캐싱한다. | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
# Lint & Test 수행 | ||
- name: Lint & Run & Unit Test | ||
run: ./gradlew check | ||
|
||
# Docker hub login | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_ID }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
# jib을 이용해 애플리케이션을 도커 허브로 배포 | ||
- name: Run Jib to deploy Application | ||
run: ./gradlew jib |