Skip to content

Commit 70eab25

Browse files
authored
Merge pull request #16 from tutorial-sejong/develop
chore: Merge develop into main for deployment
2 parents 98aef76 + ea77844 commit 70eab25

File tree

2 files changed

+41
-48
lines changed

2 files changed

+41
-48
lines changed

.github/workflow/deploy.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Deploy React App to Home Server
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: '20'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Build project
25+
run: npm run build
26+
27+
- name: Prepare deployment package
28+
run: |
29+
mkdir -p deployment_package
30+
cp -r dist/* deployment_package/
31+
- name: Install sshpass
32+
run: sudo apt-get install -y sshpass
33+
34+
- name: Deploy to Home Server
35+
env:
36+
SSHPASS: ${{ secrets.SSH_PASSWORD }}
37+
run: |
38+
sshpass -e scp -o StrictHostKeyChecking=no -r deployment_package/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/anhye0n/web/tutorial_sejong/frontend/
39+
sshpass -e ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << EOF
40+
sudo -S <<< "${{ secrets.SSH_PASSWORD }}" systemctl restart nginx
41+
EOF

0 commit comments

Comments
 (0)