This repository has been archived by the owner on Oct 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (91 loc) · 2.81 KB
/
deploy-frontend.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Deploy frontend
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: frontend/MASSter-frontend/package-lock.json
- run: npm ci
working-directory: frontend/MASSter-frontend
- run: cp .env.production.deploy .env.production
working-directory: frontend/MASSter-frontend
- run: npm run build
working-directory: frontend/MASSter-frontend
- name: Save build
uses: actions/upload-artifact@v3
with:
name: frontend-static
path: frontend/MASSter-frontend/dist
build2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: frontend/MASSter-frontend/package-lock.json
- run: npm ci
working-directory: frontend/MASSter-frontend
- run: cp .env.production.deploy2 .env.production
working-directory: frontend/MASSter-frontend
- run: npm run build
working-directory: frontend/MASSter-frontend
- name: Save build
uses: actions/upload-artifact@v3
with:
name: frontend-static-2
path: frontend/MASSter-frontend/dist
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Get build
uses: actions/download-artifact@v3
with:
name: frontend-static
path: build
- name: List build
run: ls -la build
- name: Deploy to server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: "build/"
REMOTE_HOST: ${{ secrets.DEPLOY_HOST }}
REMOTE_USER: ${{ secrets.DEPLOY_USER }}
TARGET: ${{ secrets.DEPLOY_TARGET }}
deploy2:
runs-on: ubuntu-latest
needs: build2
steps:
- name: Get build
uses: actions/download-artifact@v3
with:
name: frontend-static-2
path: build
- name: List build
run: ls -la build
- name: Deploy to server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: "build/"
REMOTE_HOST: ${{ secrets.DEPLOY_HOST_2 }}
REMOTE_USER: ${{ secrets.DEPLOY_USER }}
TARGET: ${{ secrets.DEPLOY_TARGET }}