-
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (39 loc) · 1.13 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Build and Deploy
on:
push:
branches:
- v4
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22.6.0
- name: Install Dependencies
run: npm install
- name: Build Project
run: npx quartz build
- name: Set up ssh
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/key
chmod 600 ~/.ssh/key
ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts
- name: Check Build Status
id: check_build
run: |
if [ -d public ]; then
echo "Build succeeded"
else
echo "Build failed"
exit 1
fi
- name: rsync Files to Remote Server
if: success()
run: rsync -avz -e "ssh -i ~/.ssh/key" --delete /home/runner/work/Notes/Notes ${{ secrets.USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.REMOTE_PATH }}