Merge branch 'main' of https://github.com/official-Cherry/Discord-Bot #1
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
name: Deploy to Server 20240202 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
deploy: | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' # 또는 프로젝트에 맞는 버전 | |
- name: SSH key setup | |
uses: webfactory/ssh-agent@v0.8.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PUBLIC_KEY }} | |
- name: Deploy to server | |
run: | | |
ssh -o "StrictHostKeyChecking=no" cert@13.125.237.188 << 'ENDSSH' | |
cd /home/cert/Discord-Bot | |
if [ ! -d ".git" ]; then | |
cd /home/cert | |
git clone git@github.com:Discord-Bot-AWS-certi/Discord-Bot.git | |
cd Discord-Bot | |
else | |
git reset --hard | |
git clean -df | |
git pull | |
fi | |
pm2 kill | |
npm install | |
pm2 start src/bot/index.js | |
ENDSSH |