-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a25df08
commit cdc7e3e
Showing
1 changed file
with
60 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,60 @@ | ||
name: Continuous Deployment | ||
|
||
on: | ||
push: | ||
branches: [ "develop" ] | ||
workflow_dispatch: | ||
inputs: | ||
logLevel: | ||
description: 'Log level' | ||
required: true | ||
default: 'warning' | ||
type: choice | ||
options: | ||
- info | ||
- warning | ||
- debug | ||
tags: | ||
description: 'Test scenario tags' | ||
required: false | ||
type: boolean | ||
environment: | ||
description: 'Environment to run tests against' | ||
type: environment | ||
required: false | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
develop-deploy: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
# 1. Compare branch 코드 내려 받기 | ||
- name: Checkout PR | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.push.base_ref }} | ||
|
||
# 2. Docker 이미지 build 및 push | ||
- name: Docker build and push | ||
run: | | ||
echo "${{ secrets.ENVIRONMENT }}" > .env | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker build -t jinlee1703/oot-web:latest . | ||
docker push jinlee1703/oot-web:latest | ||
# 3. SSH ACTION을 통한 Run-Command (Docker 이미지 pull 후 docker-compose를 통한 실행) | ||
- name: Deploy | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} | ||
port: ${{ secrets.SERVER_SSH_PORT }} | ||
username: ${{ secrets.SERVER_USERNAME }} | ||
password: ${{ secrets.SERVER_PASSWORD }} | ||
script: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker system prune -a -f | ||
docker pull jinlee1703/oot-web:latest | ||
docker-compose up -d |