-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (56 loc) · 1.56 KB
/
node.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Deploy Frontend
on:
push:
branches:
- main
- frontend
paths:
- 'frontend/**'
- '.github/workflows/node.yml'
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20.11.1'
- name: Install Dependencies
run: |
cd frontend
npm install
- name: Build Frontend
run: |
cd frontend
npm run build
- name: Deploy to Directory
run: |
sudo mkdir -p /var/www/restio/frontend
sudo cp -rf ./frontend/* /var/www/restio/frontend/
- name: Create .env file
run: |
echo "Creating .env file"
sudo bash -c 'cat > /var/www/restio/frontend/.env << EOL
NEXT_PUBLIC_SERVER="${{ secrets.NEXT_PUBLIC_SERVER }}"
PORT=3000'
- name: Verify .env file
run: |
if [ -f "/var/www/restio/frontend/.env" ]; then
echo ".env file created successfully"
ls -l /var/www/restio/frontend/.env
else
echo ".env file not created"
exit 1
fi
- name: Install Production Dependencies
run: |
cd /var/www/restio/frontend
sudo npm install
- name: Restart Service
run: |
sudo systemctl daemon-reload
sudo systemctl enable restio-frontend.service
sudo systemctl restart restio-frontend.service
sudo systemctl status restio-frontend.service