-
Notifications
You must be signed in to change notification settings - Fork 7
61 lines (53 loc) · 1.45 KB
/
build_and_deploy.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
name: Build and Deploy
on:
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- name: Setting up node.js
uses: actions/setup-node@v4
with:
node-version: '10.15.1'
- name: Installing dependencies
run: npm install
- name: Building the project
run: npm run build_prod
env:
CI: ""
- name: Uploading artifact
uses: actions/upload-artifact@v4
with:
name: build
path: "build/*"
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production
needs: build
steps:
- name: Pulling build files
uses: actions/download-artifact@v4
with:
name: build
path: ""
- name: Backing up the previous build
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
key: ${{ secrets.KEY }}
username: ${{ secrets.USERNAME }}
script: |
cp -a ${{ secrets.DEPLOY_DIR }} ${{ secrets.DEPLOY_DIR }}.bak-`date +"%s"`
rm -rf ${{ secrets.DEPLOY_DIR }}/*
- name: Sending files to production
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
key: ${{ secrets.KEY }}
username: ${{ secrets.USERNAME }}
source: "*"
target: ${{ secrets.DEPLOY_DIR }}