-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: addded github action: deploy-main.yml
- Loading branch information
Showing
2 changed files
with
48 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,25 @@ | ||
name: remote ssh command for deploy | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
# 레포지토리 체크아웃 | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# SSH를 사용하여 스크립트 실행 | ||
- name: executing remote ssh commands using key | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.KEY }} | ||
port: ${{ secrets.PORT }} | ||
script: | | ||
./git/react-api-cicd/scripts/deploy.sh |
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,23 @@ | ||
#!/bin/bash | ||
|
||
npm -g install yarn | ||
|
||
source ~/.bash_profile | ||
cd ~/git/react-api-cicd/ | ||
git pull origin main | ||
|
||
# front-end | ||
cd frontend/ | ||
yarn install | ||
yarn build | ||
cp -rf dist/* ../backend/public | ||
|
||
# back-end | ||
cd ../backend/ | ||
yarn install | ||
|
||
# pm2 | ||
pm2 stop react-api-cicd | ||
pm2 start bin/www --name react-api-cicd --update-env | ||
sleep 2 | ||
pm2 list |