-
Notifications
You must be signed in to change notification settings - Fork 1
34 lines (29 loc) · 1.03 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Deploy to Server
# main 브랜치로 푸시할 때 이 워크플로우 실행
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# GitHub에서 리포지토리 코드를 가져오는 단계
- name: Checkout code
uses: actions/checkout@v2
# 서버로 SSH 연결을 통한 배포
- name: Deploy to server via SSH
if: ${{secrets.SERVER_HOST && secrets.SERVER_USER && secrets.SERVER_SSH_KEY}} # Secret이 존재할 때만 실행
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
cd ./ArWebAuth/
git pull origin master
npm install
pm2 restart www
- name: Skip deployment in fork
if: ${{secrets.SERVER_HOST == null || secrets.SERVER_USER == null || secrets.SERVER_SSH_KEY == null}}
run: echo "Secrets not found. Skipping deployment."