-
-
Notifications
You must be signed in to change notification settings - Fork 273
62 lines (55 loc) · 1.86 KB
/
deploy-languages-v2-web.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
name: Deploy Languages V2 Web
on:
pull_request:
branches: [main]
types:
- labeled
- synchronize
jobs:
build-and-deploy:
name: Build and Deploy
if: ${{ github.event.label.name == 'deploy-languages-v2-web' }}
runs-on: ubuntu-latest
env:
PROJECT_PATH: apps/languagesv2/languages-v2-web
TARGET_PATH: /root/apps
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies
working-directory: ${{ env.PROJECT_PATH }}
run: npm install
- name: Build React App
working-directory: ${{ env.PROJECT_PATH }}
run: npm run build
- name: Clean target folder on remote server
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.UTS_HOST }}
username: ${{ secrets.UTS_USERNAME }}
password: ${{ secrets.UTS_PASSWORD }}
port: ${{ secrets.UTS_PORT }}
script: |
rm -rf ${{ env.TARGET_PATH }}/*
- name: Copy build files via SCP
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.UTS_HOST }}
username: ${{ secrets.UTS_USERNAME }}
password: ${{ secrets.UTS_PASSWORD }}
port: ${{ secrets.UTS_PORT }}
source: "${{ env.PROJECT_PATH }}/build/*"
target: "${{ env.TARGET_PATH }}"
recursive: true
- name: Clean target folder on remote server
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.UTS_HOST }}
username: ${{ secrets.UTS_USERNAME }}
password: ${{ secrets.UTS_PASSWORD }}
port: ${{ secrets.UTS_PORT }}
script: |
mv ${{ env.TARGET_PATH }}/${{ env.PROJECT_PATH }}/build/* ${{ env.TARGET_PATH }}/ && rm -rf ${{ env.TARGET_PATH }}/apps