-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (36 loc) · 1.1 KB
/
ci-cd.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
name: React App CI/CD
on:
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
env:
REACT_APP_SERVER_IMAGE_PATH: ${{ secrets.REACT_APP_SERVER_IMAGE_PATH }}
REACT_APP_API: ${{ secrets.REACT_APP_API }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: '16' # Specify the Node.js version
- name: Delete node_modules
run: rm -rf node_modules/
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn run build
- name: Deploy to Ubuntu Server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_ADDR }}
username: stefan
key: ${{ secrets.SERVER_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
port: 22
source: build/ # Adjust this path to your build output
target: /home/stefan/frontend/
- name: Clean up
run: rm -rf build/